I'm facing an issue installing angular-cli locally. I'm on Ubuntu 16.04.2 LTS with following versions of node.js and npm:
我正面临在本地安装angular-cli的问题。我在Ubuntu 16.04.2 LTS上使用以下版本的node.js和npm:
node: v7.10.0
npm: 3.10.10
I tried to install angluar-cli using the following command:
我尝试使用以下命令安装angluar-cli:
$npm install -g @angular/cli@1.0.0
this worked fine and completed with following warnings:
这工作正常,并完成以下警告:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY:
fsevents@^1.0.0 (node_modules/@angular/cli/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"})
Now when I'm trying 'ng' command:
现在当我正在尝试'ng'命令时:
module.js:472
throw err;
^
Error: Cannot find module 'abbrev'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/@angular /cli/node_modules/nopt/lib/nopt.js:10:14)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
3 个解决方案
#1
3
Just do this on command line:
只需在命令行执行此操作:
sudo npm uninstall -g @angular/cli
sudo npm cache verify
sudo npm install -g @angular/cli --unsafe-perm=true --allow-root
Found here:Error: EACCES: permission denied, mkdir...!
在这里找到:错误:EACCES:权限被拒绝,mkdir ......!
This fix the npm EACCES permission denied which brake the angular/cli install on ubuntu 17.04 for me.
这修复了npm EACCES权限被拒绝哪个为我设置了ubuntu 17.04上的angular / cli安装。
#2
2
npm install @angular/cli@latest
npm install @ angular / cli @ latest
will not install angular-cli globally but it works for you user.
不会全局安装angular-cli,但它适用于您的用户。
#3
#1
3
Just do this on command line:
只需在命令行执行此操作:
sudo npm uninstall -g @angular/cli
sudo npm cache verify
sudo npm install -g @angular/cli --unsafe-perm=true --allow-root
Found here:Error: EACCES: permission denied, mkdir...!
在这里找到:错误:EACCES:权限被拒绝,mkdir ......!
This fix the npm EACCES permission denied which brake the angular/cli install on ubuntu 17.04 for me.
这修复了npm EACCES权限被拒绝哪个为我设置了ubuntu 17.04上的angular / cli安装。
#2
2
npm install @angular/cli@latest
npm install @ angular / cli @ latest
will not install angular-cli globally but it works for you user.
不会全局安装angular-cli,但它适用于您的用户。