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

查看:38
本文介绍了@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

当我尝试按照 中的步骤安装 @angular-cli 时文档,运行 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 无关 参考.似乎更可能是您的机器权限问题或 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:

安装完 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天全站免登陆