nvm installed node and npm, symlink issue when installing local browserify

為{幸葍}努か 提交于 2020-01-15 08:33:20

问题


Today I have installed the latest version of node through nvm on Linux Mint (Ubuntu 13.10).

Thanks to nvm, I now don't have to use the sudo command with npm - which has solved problems with a few packages.

$ node -v
v0.10.29
$ npm -v
1.4.14

However when entering this command:

npm install browserify --save-dev

I now get the following error:

npm ERR! Error: EACCES, symlink '../browserify/bin/cmd.js'
npm ERR!  { [Error: EACCES, symlink '../browserify/bin/cmd.js'] errno: 3, code: 'EACCES', path: '../browserify/bin/cmd.js' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/home/dave/.nvm/v0.10.29/bin/node" "/home/dave/.nvm/v0.10.29/bin/npm" "install" "browserify" "--save-dev"
npm ERR! cwd /var/www/100mondays-l4.2/frontend
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.14
npm ERR! path ../browserify/bin/cmd.js
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, symlink '../browserify/bin/cmd.js'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /var/www/100mondays-l4.2/frontend/npm-debug.log
npm ERR! not ok code 0

When I try to comply with the error advice:

$ sudo npm install browserify --save-dev
sudo: npm: command not found

I have been able to install other modules with npm - globally and locally - with no issues. So my guess is the error is to do with symlinks? My local site is in /var/www/ but my node/npm installation is in ~/.nvm/, and my home folder doesn't follow symlinks? However I'm not a server/Linux expert so could be off the mark.

This works fine:

npm install browserify -g

Any help greatly received.


回答1:


Adding browserify to my package.json manually and using npm install from the project root solved my issue. Not really sure why.



来源:https://stackoverflow.com/questions/25050854/nvm-installed-node-and-npm-symlink-issue-when-installing-local-browserify

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!