Nixpkgs: npm link fails due to read-only fs

Created on 23 Jun 2016  路  1Comment  路  Source: NixOS/nixpkgs

Issue description

The location that npm link tries to install symlinks into is inside of it's /nix installation directory which is unwritable, and thus fails. Specifically, when trying to link a package named foo, it tries to create a symlink at /nix/store/<nodejs-nix-package-hash>-nodejs-<nodejs-version>/lib/node_modules/foo.

It should try writing (and reading) to somewhere else that's actually allowed to be written to.

Steps to reproduce

Do npm link inside a node.js package.

If you don't have a local node.js package:

  1. Install Node.js. (nix-env -iA nixpkgs.nodejs)
  2. Create a directory, and cd into it.
  3. npm init to create a package.json.
  4. npm link

Most helpful comment

It is possible to make a workaround for this by having a custom prefix inside ~/.npmrc. So if you create ~/.npmrc with content:

  prefix=~/.npm

Next time your run npm link or npm install -g, it would use ~/.npm as root folder.

It would be nice to incorporate this inside nodejs nix expression so it could use some global writable folder by default. I would take a closer look if we could have this in nodejs expression.

>All comments

It is possible to make a workaround for this by having a custom prefix inside ~/.npmrc. So if you create ~/.npmrc with content:

  prefix=~/.npm

Next time your run npm link or npm install -g, it would use ~/.npm as root folder.

It would be nice to incorporate this inside nodejs nix expression so it could use some global writable folder by default. I would take a closer look if we could have this in nodejs expression.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

langston-barrett picture langston-barrett  路  3Comments

teto picture teto  路  3Comments

matthiasbeyer picture matthiasbeyer  路  3Comments

ayyess picture ayyess  路  3Comments

lverns picture lverns  路  3Comments