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

cannot install -g @angular/cli

Open Bill4869 opened this issue 8 years ago • 16 comments

Versions

Angular CLI: 1.7.0 Node: 8.9.4 OS: linux ia32 Angular: ...

Repro steps

npm install -g @angular/cli npm WARN checkPermissions Missing write access to /usr/lib/node_modules/@angular/cli npm WARN checkPermissions Missing write access to /usr/lib/node_modules/@angular/cli/node_modules/fsevents npm WARN checkPermissions Missing write access to /usr/lib/node_modules/@angular npm WARN checkPermissions Missing write access to /usr/lib/node_modules/@angular/cli/node_modules npm WARN [email protected] requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! path /usr/lib/node_modules/@angular/cli npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules/@angular/cli' npm ERR! { Error: EACCES: permission denied, access '/usr/lib/node_modules/@angular/cli' npm ERR! stack: 'Error: EACCES: permission denied, access '/usr/lib/node_modules/@angular/cli'', npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/lib/node_modules/@angular/cli' } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in: npm ERR! /home/aptx-4869/.npm/_logs/2018-02-18T15_16_22_569Z-debug.log

Mention any other details that might be useful (optional)

i just want to be able to install it does anyone know how to solve this problem? thank you in advance

Bill4869 avatar Feb 18 '18 15:02 Bill4869

I have been having the same issue The way i got to to install was by: two root shell or sudo su one one: npm install -g @angular/cli on the second: cd /usr/lib/node_modules/@angular/

after a bit the following message starts repeatedly appearing on the first terminal

gyp verb command install [ '8.9.4' ]
gyp verb install input version string "8.9.4"
gyp verb install installing version: 8.9.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.9.4
gyp verb ensuring nodedir is created /usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.9.4
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.9.4"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space

So on the second terminal i did chmod a+rwx cli/ -R

after this the message stopped and the install continued as it should have.

I had this same problem in the last hour, and this allowed me to install angular, so far i have seen no issues with the installation.

BTW: I did this on a fresh install of ubuntu 16.04lts from the minimalist instalation (https://help.ubuntu.com/community/Installation/MinimalCD)

lrebelo avatar Feb 18 '18 19:02 lrebelo

I faced this issue on multiple dev machines. Its coming more to the Linux / Mac users than to Windows users. You will need to do sudo npm install -g @angular/cli . And then you can use angular CLI wherever you want to use. I did this yesterday and its working like charm.

kaydeveloper avatar Feb 19 '18 01:02 kaydeveloper

I'm having a problem on Windows 10, NPM 5.6, Node : 7.5 Here's the errorlog:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\some_dude\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '@angular/cli',
1 verbose cli   '-g' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 45122a214b88564d
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 404 http://registry.npmjs.org/@angular%2fcli 641ms
8 silly fetchPackageMetaData error for @angular/cli@latest 404 Not Found: @angular/cli@latest
9 verbose stack Error: 404 Not Found: @angular/cli@latest
9 verbose stack     at fetch.then.res (C:\Users\some_dude\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\lib\fetchers\registry\fetch.js:42:19)
9 verbose stack     at tryCatcher (C:\Users\some_dude\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
9 verbose stack     at Promise._settlePromiseFromHandler (C:\Users\some_dude\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31)
9 verbose stack     at Promise._settlePromise (C:\Users\some_dude\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
9 verbose stack     at Promise._settlePromise0 (C:\Users\some_dude\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
9 verbose stack     at Promise._settlePromises (C:\Users\some_dude\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
9 verbose stack     at Async._drainQueue (C:\Users\some_dude\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\async.js:133:16)
9 verbose stack     at Async._drainQueues (C:\Users\some_dude\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\async.js:143:10)
9 verbose stack     at Immediate.Async.drainQueues (C:\Users\some_dude\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\async.js:17:14)
9 verbose stack     at runCallback (timers.js:651:20)
9 verbose stack     at tryOnImmediate (timers.js:624:5)
9 verbose stack     at processImmediate [as _immediateCallback] (timers.js:596:5)
10 verbose cwd C:\Projects\MyProject\app
11 verbose Windows_NT 10.0.14393
12 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\some_dude\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "@angular/cli" "-g"
13 verbose node v7.5.0
14 verbose npm  v5.6.0
15 error code E404
16 error 404 Not Found: @angular/cli@latest
17 verbose exit [ 1, true ]

Also, tried just taking this url (http://registry.npmjs.org/@angular%2fcli) and putting it in a browser and it returned all the package info. I can install other packages without any problems.

buddyackerman avatar Feb 19 '18 21:02 buddyackerman

Not sure, but its a unix file system so its possible.

On 18 February 2018 at 22:05, Muhammad Arif [email protected] wrote:

@lrebelo https://github.com/lrebelo Would your solution work on MacOS?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/9676#issuecomment-366552139, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNNcm_b918KoRxl56qfX0QyelIdvGVLks5tWJ6-gaJpZM4SJuxR .

lrebelo avatar Feb 19 '18 23:02 lrebelo

@kaydeveloper I had had the issue initially while running the command as sudo.

lrebelo avatar Feb 19 '18 23:02 lrebelo

Same problem here and with the solution of @lrebelo I´m running now angular-cli in kubuntu 17.10 with node 9.5.0 version

isanchezd avatar Feb 21 '18 15:02 isanchezd

Same issue for me, I used sudo su to install the CLI. The issue seems to occur when npm install -g @angular/cli is triggered with sudo. I am always a bit hesitant to log in as the root user on my system using sudo su. Would like to see a fix so we can just use sudo npm install -g @angular/cli like we normally would.

Angular CLI: 1.7.3
Node: 9.8.0
OS: linux x64
Angular: 

sanderkoenders avatar Mar 09 '18 09:03 sanderkoenders

I had the same issue with sudo npm i @angular/cli -g OS: Ubuntu 16.04 LTS Node: 9.8.0 NPM: 5.7.0 CLI: 1.7.3

fixed the issue with the solution from @lrebelo . However, the solution set the folder cli with permission 777, which I am not sure is safe.

greengalaxy2016 avatar Mar 21 '18 14:03 greengalaxy2016

Thanks a lot @lrebelo I'd been stuck on this for hours.

ish-101 avatar Mar 27 '18 00:03 ish-101

Interestingly, I had the issue on Fedora 28 in a root shell (entered via sudo -i). Later on, doing sudo npm install -g @angular/cli in the shell of a regular user worked fine.

using: npm version 5.6.0 node version v8.9.4 angular CLI version 1.7.3

janvlug avatar Mar 30 '18 21:03 janvlug

i had the same issue.

MacBooks-MacBook-Pro:~ macbookpro$ npm install -g @angular/cli@latest npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/@angular/cli npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/@angular npm ERR! path /usr/local/lib/node_modules/@angular/cli npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall access npm ERR! enoent ENOENT: no such file or directory, access '/usr/local/lib/node_modules/@angular/cli' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in: npm ERR! /Users/macbookpro/.npm/_logs/2018-05-17T01_33_24_105Z-debug.log

after one day working finally i got what is the problem. since we uninstall the cli some times the node_modules wont uninstall or missing the the accessibility to cli just directly open your node_modules dir you will see angular folder, remove the angular folder manually then install your angular cli from npm install @angular.cli.

hayat12 avatar May 17 '18 01:05 hayat12

This is a problem with your setup in NPM. I'm going to close this as there's nothing we can do, unfortunately. If you think your setup is good and it's a problem with NPM, you should file an issue on their repo.

Thanks!

hansl avatar Sep 27 '18 15:09 hansl

first know your whoami by running command in terminal whoami

user_name

then, change ownership of these 3 directories to the above user_name (your user) sudo chown -R user_name /usr/local/lib/node_modules/ sudo chown -R user_name /usr/local/bin/ sudo chown -R user_name /usr/local/share/

and the EACCES error will go away.

bhrugs avatar Feb 18 '19 19:02 bhrugs

I faced this issue on multiple dev machines. Its coming more to the Linux / Mac users than to Windows users. You will need to do sudo npm install -g @angular/cli . And then you can use angular CLI wherever you want to use. I did this yesterday and its working like charm.

shamazg avatar Jul 26 '19 22:07 shamazg

Thank you, it worked for me :)

shamazg avatar Jul 26 '19 22:07 shamazg

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.