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:
node: v7.10.0
npm: 3.10.10
I tried to install angluar-cli using the following command:
$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:
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)
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... !
This fix the npm EACCES permission denied which brake the angular/cli install on ubuntu 17.04 for me.
npm install @angular/cli@latest
不会在全局安装angular-cli,但它适用于用户。
我通过学习本文解决了这个问题: 修复npm权限
To install it globally, use
npm install -g @angular/cli
To install last version and globally, use
npm install -g @angular/cli@latest
And if you are using Ubuntu 18.04, use
sudo npm install -g @angular/cli@latest
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.