How do I install angular-cli on ubuntu 16,04?

12,092

Solution 1

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.

Solution 2

npm install @angular/cli@latest

Will not install angular-cli globally but it works for user.

Solution 3

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

Solution 4

I resolve this problem by learning this article : Fixing npm permissions

Share:
12,092
Yogesh
Author by

Yogesh

Updated on June 28, 2022

Comments

  • Yogesh
    Yogesh almost 2 years

    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/[email protected]
    

    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 [email protected]: 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)