安装角度CLI时收到错误作为警告 [英] Getting error as warning while installing angular CLI

查看:102
本文介绍了安装角度CLI时收到错误作为警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是这个平台的新手.

我安装了 Node.js ,但是当我尝试运行命令 npm install -g @ angular/cli 时,我收到此错误:

I installed Node.js but when I try to run command npm install -g @angular/cli I received this error:

**npm WARN deprecated mkdirp@0.5.3: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN rollback Rolling back @schematics/angular@9.0.6 failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\Vivek\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@sche**

此外,当我尝试运行版本命令

Also when I try to run command for version

它告诉我

**C:\Users\Vivek>ng v
internal/modules/cjs/loader.js:985
  throw err;
  ^
Error: Cannot find module 'C:\Users\Vivek\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng'**

推荐答案

尝试一下...

要将所有软件包更新到新的主要版本,请全局安装npm-check-updates软件包:

To update to a new major version all the packages, install the npm-check-updates package globally:

npm install -g npm-check-updates

然后运行ncu:

ncu -u  --packageFile package.json

这会将package.json文件中的所有版本提示升级为依赖关系和devDependencies,因此npm可以安装新的主要版本.现在您可以运行更新了:

this will upgrade all the version hints in the package.json file, to dependencies and devDependencies, so npm can install the new major version. You are now ready to run the update:

npm update

忽略任何审核建议,然后再次运行安装...

ignore any audit suggestions and run install again...

npm install

这应该是弃用警告.

这篇关于安装角度CLI时收到错误作为警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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