Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@angular-cli install fails with deprecated [email protected]: request has been deprecated (mac)

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.

like image 328
Ben Mordechai Avatar asked Feb 15 '20 00:02

Ben Mordechai


5 Answers

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

like image 142
Ha Kim Avatar answered Oct 23 '22 18:10

Ha Kim


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

like image 5
angularrocks.com Avatar answered Oct 23 '22 16:10

angularrocks.com


I removed "node_modules" folder & "package-lock.json" file and then execute following 2 commands:

npm init

npm install

And then, it worked properly.

like image 2
Nixxxxx Avatar answered Oct 23 '22 16:10

Nixxxxx


I tried cleaning cache and it worked for me.

npm cache clean --force
like image 2
daniel rubambura Avatar answered Oct 23 '22 16:10

daniel rubambura


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.

like image 1
SaeedSoltani Avatar answered Oct 23 '22 18:10

SaeedSoltani