本文介绍了无法安装npm软件包||没有权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在安装PM2时出现以下错误.我也尝试过在本地安装它,但似乎没有任何效果.请帮忙.
I am getting the following error while installing PM2. I have also tried installing it locally but nothing seems to be working. please help.
命令:npm install pm2 -g
Command:npm install pm2 -g
anil@anil:~/Desktop/restapis$ npm install pm2 -g
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/pm2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 4.4.0-78-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "pm2" "-g"
npm ERR! node v6.10.3
npm ERR! npm v3.10.10
npm ERR! path ../lib/node_modules/pm2/bin/pm2
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall symlink
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/pm2/bin/pm2' -> '/usr/local/bin/pm2'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, symlink '../lib/node_modules/pm2/bin/pm2' -> '/usr/local/bin/pm2'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../lib/node_modules/pm2/bin/pm2',
npm ERR! dest: '/usr/local/bin/pm2' }
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! /home/anil/Desktop/restapis/npm-debug.log
anil@anil:~/Desktop/restapis$ ^C
anil@anil:~/Desktop/restapis$ sudo chmod 777 /lib/node_modules/pm2/bin/pm2
chmod: cannot access '/lib/node_modules/pm2/bin/pm2': No such file or directory
anil@anil:~/Desktop/restapis$ x
推荐答案
您正试图将PM2安装为/usr/local/bin/pm2
,并且需要root访问权限.
You are trying to instal PM2 as /usr/local/bin/pm2
and you need root access for that.
代替:
npm install pm2 -g
您需要:
sudo npm install pm2 -g
请注意,您需要属于sudoers组.
Note that you need to be in the sudoers group.
或者,您可以将Node安装在您的主目录中,而不是在系统范围内安装,这样您就不需要sudo
作为install -g
Alternatively you can install Node in your home directory instead of system-wide and then you won't need sudo
for install -g
这篇关于无法安装npm软件包||没有权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!