@ angular-cli安装因请求@ 2.88.2被弃用而失败:请求已被弃用(mac) [英] @angular-cli install fails with deprecated request@2.88.2: request has been deprecated (mac)

查看:568
本文介绍了@ angular-cli安装因请求@ 2.88.2被弃用而失败:请求已被弃用(mac)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将node.js和npm更新为当前的LTS之后:

After updating node.js and npm to current LTS:

node -v
v12.16.0

npm -v
6.13.4

当我尝试按照文档,运行npm install -g @angular/cli 在终端中停止安装,控制台输出为:

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 request@2.88.2: 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/cli@9.0.2 postinstall /USERS/USER/.npm-global/lib/node_modules/@angular/cli
> node ./bin/postinstall/script.js

+ @angular/cli@9.0.2
updated 1 package in 12.202s

在这种情况下,ng new project-name产生-bash: ng: command not found.任何帮助都将非常受欢迎,因为我正在进行一个大项目. 谢谢大家.

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.

推荐答案

您遇到的问题与在控制台npm warning -cli/issues/16952"rel =" nofollow noreferrer>参考.您的计算机上的权限问题或NodeJS安装问题,或两者兼而有之,这似乎更有可能是问题.

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.

我建议首先完全删除您的NodeJS安装,然后再安装NVM来管理您的NodeJS实例:

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

安装完NVM后,尝试安装Angular CLI:

Once you done installing NVM try to install Angular CLI:

npm install @angular/cli -g

希望有帮助!

更新:您也可以检查问题

这篇关于@ angular-cli安装因请求@ 2.88.2被弃用而失败:请求已被弃用(mac)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆