【问题标题】:Getting error as warning while installing angular CLI安装 Angular CLI 时收到错误警告
【发布时间】:2020-03-18 10:01:42
【问题描述】:

我是这个平台的新手。

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

**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**

当我尝试为版本运行命令时

它告诉我

**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'**

【问题讨论】:

    标签: node.js angular npm error-handling angular-cli


    【解决方案1】:

    试试这个...

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

    npm install -g npm-check-updates
    

    然后运行 ​​ncu:

    ncu -u  --packageFile package.json
    

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

    npm update
    

    忽略任何审核建议并再次运行安装...

    npm install
    

    这应该是弃用警告。

    【讨论】:

      【解决方案2】:

      按照以下步骤操作:

      1. 转到链接:https://github.com/angular/angular-cli

      2. 点击存储库:“angular/angular-cli”

      3. 点击:“克隆或下载”

      4. 在本地选择“下载 zip”..

      5. 解压步骤 4

      6. 将解压文件夹“node_modules”复制到地址C:\Users\ICT\AppData\Roaming\npm

      7. 我当前的用户 = ICT

      8. 打开 CMD 并执行:“npm install -g @angular/cli”

      【讨论】:

      • 嗨@morteza.marivani,欢迎来到 Stackoverflow!为了提供高质量的答案,我建议解释一下为什么这可以解决问题,因为不清楚。
      猜你喜欢
      • 2018-07-06
      • 2018-01-29
      • 1970-01-01
      • 1970-01-01
      • 2021-04-03
      • 1970-01-01
      • 1970-01-01
      • 2023-03-29
      • 1970-01-01
      相关资源
      最近更新 更多