When I install npm install -g ionic cordova It throws below error
当我安装npm install -g ion cordova时抛出以下错误
npm WARN checkPermissions Missing write access to /usr/lib/node_modules npm ERR! path /usr/lib/node_modules npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules' npm ERR! { Error: EACCES: permission denied, access '/usr/lib/node_modules' npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/lib/node_modules\'', npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/lib/node_modules' } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator (though this is not recommended).
npm WARN checkPermissions缺少对/ usr / lib / node_modules的写访问权限npm ERR! path / usr / lib / node_modules npm ERR!代码EACCES npm ERR! errno -13 npm ERR!系统调用访问npm ERR!错误:EACCES:权限被拒绝,访问'/ usr / lib / node_modules'npm ERR! {错误:EACCES:权限被拒绝,访问'/ usr / lib / node_modules'npm ERR! stack:'错误:EACCES:权限被拒绝,访问\'/ usr / lib / node_modules \'',npm ERR!错误:-13,npm ERR!代码:'EACCES',npm ERR!系统调用:'access',npm ERR!路径:'/ usr / lib / node_modules'} npm ERR!错误的ERR!您的操作系统拒绝了该操作。错误的ERR!您可能没有权限以当前用户npm ERR的身份访问此文件!错误的ERR!如果您认为这可能是权限问题,请仔细检查npm ERR!文件及其包含目录的权限,或尝试运行npm ERR!该命令再次以root / Administrator(尽管不建议这样做)。
npm ERR! A complete log of this run can be found in: npm ERR!
/home/javauser/.npm/_logs/2018-05-19T04_42_24_737Z-debug.log错误的ERR!可以在以下位置找到此运行的完整日志:npm ERR! /home/javauser/.npm/_logs/2018-05-19T04_42_24_737Z-debug.log
I tried with root user as well. I am using node v9.11.1 , npm 6.0.1
我也尝试过root用户。我使用的是节点v9.11.1,npm 6.0.1
1 个解决方案
#1
0
run with sudo in Mac OS or linux
在Mac OS或Linux中使用sudo运行
sudo npm install -g ionic cordova
or in windows open cmd with run as administrator
或在Windows中以管理员身份运行cmd
npm install -g ionic cordova
#1
0
run with sudo in Mac OS or linux
在Mac OS或Linux中使用sudo运行
sudo npm install -g ionic cordova
or in windows open cmd with run as administrator
或在Windows中以管理员身份运行cmd
npm install -g ionic cordova