@angular-cli install fails with deprecated [email protected]: request has been deprecated (mac)
Solution 1
The issue you are experiencing has noting to do with npm warning
you see in console ref. It is seems more likely a problem with permissions on your machine or NodeJS installation issue or both.
I would recommend to remove your NodeJS installation completely at first and then install NVM to manage your NodeJS instances:
- Mac/Linux: https://github.com/nvm-sh/nvm
- Windows:https://github.com/coreybutler/nvm-windows
Once you done installing NVM try to install Angular CLI:
npm install @angular/cli -g
Hope it helps!
UPDATE: Also you can check this issue
Solution 2
Unfortunately, Request package was deprecated. and that according to Mikeal Rogers (creator of request) read this link
and for more information, you can read this article
Solution 3
I removed "node_modules" folder & "package-lock.json" file and then execute following 2 commands:
npm init
npm install
And then, it worked properly.
Solution 4
I tried cleaning cache and it worked for me.
npm cache clean --force
Solution 5
The package request is now fully deprecated. So that will probably take a while to change. I think the solution would be for angular cli to release a new version that is not reliant upon request.
Ben Mordechai
Updated on July 09, 2022Comments
-
Ben Mordechai almost 2 years
After updating node.js and npm to current LTS:
node -v v12.16.0
npm -v 6.13.4
When I'm trying to install @angular-cli following the steps in the documentation, running
npm install -g @angular/cli
in the terminal stops the installation and the console output is:npm install -g @angular/cli npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142 /Users/user/.npm-global/bin/ng -> /USERS/USER/.npm-global/lib/node_modules/@angular/cli/bin/ng > @angular/[email protected] postinstall /USERS/USER/.npm-global/lib/node_modules/@angular/cli > node ./bin/postinstall/script.js + @angular/[email protected] updated 1 package in 12.202s
And in this case,
ng new project-name
yields-bash: ng: command not found
. Any help would be very welcome as I have a big project coming up. Thanks all. -
bryan60 about 4 yearsRequest is still maintained and works fine. This issue is not related to request being deprecated
-
Ben Mordechai about 4 yearsHi, thanks for the great reply! Unfotunatley this didn't work as when running
ng new
terminal still prints out-bash: ng: command not found
. This is pretty weird as I've uninstalled and reinstalled node.js and angular-cli. Maybe this a permissions issue on the computer? -
angularrocks.com about 4 years@BenMordechai are you using NVM now?
-
Ben Mordechai about 4 yearsYes, I've installed nvm and checked it's installation
-
angularrocks.com about 4 years@BenMordechai did you remove the nodejs installation before installing NVM? Also checkout this issue github.com/angular/angular-cli/issues/503