简体   繁体   English

使用 npm 安装模块时出现符号链接错误

[英]Symlink error when installing modules with npm

I'm trying to install nodemon globally but I'm getting the following error:我正在尝试全局安装 nodemon,但出现以下错误:

npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "nodemon"
npm ERR! node v5.10.1
npm ERR! npm  v3.8.3
npm ERR! path ../lib/node_modules/nodemon/bin/nodemon.js
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! syscall symlink

npm ERR! Error: EPERM: operation not permitted, symlink '../lib/node_modules/nodemon/bin/nodemon.js' -> '/usr/local/bin/nodemon'
npm ERR!     at Error (native)
npm ERR!  { [Error: EPERM: operation not permitted, symlink '../lib/node_modules/nodemon/bin/nodemon.js' -> '/usr/local/bin/nodemon']
npm ERR!   errno: -1,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../lib/node_modules/nodemon/bin/nodemon.js',
npm ERR!   dest: '/usr/local/bin/nodemon' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Juanjo/Developer/budget-app/npm-debug.log

I'm new to node (literally the first thing I tried to run after installing it) but I don't think I'm supposed to use sudo to install modules, so perhaps there's something wrong with permissions or something, I just haven't been able to find out what it is.我是 node 的新手(实际上是我在安装它后尝试运行的第一件事)但我认为我不应该使用 sudo 来安装模块,所以也许权限有问题或什么的,我只是没有无法找出它是什么。 Any help is really appreciated.任何帮助都非常感谢。

This is on OS X 10.11.这是在 OS X 10.11 上。 I already tried both我已经试过了

sudo chown -R `whoami` /usr/local/lib/node_modules

and

sudo chown -R `whoami` /usr/local

But still no luck.但仍然没有运气。

Symlink Issues could really be an issue.符号链接问题可能真的是一个问题。

For me, the shortcut was to turn it off by running the installation wihout symlink options like this below:对我来说,快捷方式是通过运行安装来关闭它,而没有符号链接选项,如下所示:

npm install --no-bin-links

我通过完全删除 /usr/local 并再次创建来修复它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM