angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

cli won't install on ubuntu 16.04 without installing node-gyp manually

Open rotemfogel opened this issue 9 years ago • 23 comments

Bug Report or Feature Request (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request

Versions.

$ ng -v; node -v; npm -v
    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.1.2
node: 8.1.2
os: linux x64
v8.1.2
5.0.3

Repro steps.

  • install ubuntu 16.04
  • install nodejs (using apt) sudo apt-get install -y nodejs
  • install @angular/cli sudo npm install -g @angular/cli

The log given by the failure.

@angular/cli refuses to install, saying root user is not allowed to write into /usr/lib/node_modules/.... The install process retries endlessly.

Desired functionality.

@angular/cli to check if node-gyp is installed an either fail saying requirement missing or install it by itself

Mention any other details that might be useful.

A fix for the issue, is manually installing node-gyp prior to installing @angular/cli

$ sudo npm install -g node-gyp
$ sudo npm install -g @angular/cli

rotemfogel avatar Jun 18 '17 14:06 rotemfogel

In Ubuntu 18.04 You have to follow some steps

On the command line, in your home directory, create a directory for global installations: step 1 mkdir ~/.npm-global

Configure npm to use the new directory path: step 2 npm config set prefix '~/.npm-global'

In your preferred text editor, open or create a ~/.profile file and add this line: step 3 export PATH=~/.npm-global/bin:$PATH

On the command line, update your system variables: step 4 source ~/.profile

To test your new configuration, install a package globally without using sudo step 5 npm install -g jshint

I hope it will help you also

MohitTejwani avatar Dec 24 '18 12:12 MohitTejwani

The CLI has been updated significantly since version 1.1.2. The current stable version is 8.3.5. If this problem is still being encountered with the current version, please consider opening a new issue with updated details.

clydin avatar Sep 19 '19 23:09 clydin

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.