Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm link fails due to read-only fs #16441

Closed
Havvy opened this issue Jun 23, 2016 · 2 comments
Closed

npm link fails due to read-only fs #16441

Havvy opened this issue Jun 23, 2016 · 2 comments

Comments

@Havvy
Copy link
Contributor

Havvy commented Jun 23, 2016

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
@Havvy Havvy changed the title npm link fails due to read-only fs npm link fails due to read-only fs Jun 23, 2016
@dejanr
Copy link

dejanr commented Aug 18, 2016

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.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/can-you-use-npm-link-with-a-nix-shell/40812/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants