Ionic 2 - 错误:EACCES:在Ubuntu 12.04LTS上安装时拒绝权限 [英] Ionic 2 - Error: EACCES: permission denied in installation on Ubuntu 12.04LTS

查看:194
本文介绍了Ionic 2 - 错误:EACCES:在Ubuntu 12.04LTS上安装时拒绝权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照 http://ionicframework.com/docs/v2/getting-started/installation/

使用的命令

安装nodejs 6.x

cookbook$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
cookbook$ sudo apt-get install -y nodejs
cookbook$ node -v
v6.9.1
[~]
cookbook$ npm -v
3.10.8
[~]

install ionic per说明

cookbook$ npm install -g ionic cordova



+-- readable-stream@1.0.34 
| +-- core-util-is@1.0.2 
| +-- inherits@2.0.3 
| +-- isarray@0.0.1 
| `-- string_decoder@0.10.31 
`-- setimmediate@1.0.5 

npm ERR! Linux 3.8.0-29-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "ionic" "cordova"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
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!     at Error (native)
npm ERR!  { Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!     at Error (native)
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/lib/node_modules' }
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/cookbook/npm-debug.log
[~]

错误消息表明尝试再次以root / Administrator身份运行此命令。

The error message suggests to try running this command again as root/Administrator.

正确的方法是什么?

Windows 10上的类似问题此处

similar issue on windows 10 here

推荐答案

不要使用sudo,从长远来看会带来更多问题。以下指南对此进行了完美解释:(适用于OSX,但适用相同)

Do not use sudo, it will bring more problems on the long term. The following guide explains it perfectly: (Its for OSX but applies the same)

https://johnpapa.net/how-to-use-npm-global-without-sudo-on-osx/

这篇关于Ionic 2 - 错误:EACCES:在Ubuntu 12.04LTS上安装时拒绝权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆