安装 @angular/cli 由于npm的版本问题出现 Unsupported engine 导致安装不成功的问题解决记录
$ npm install -g @angular/cli

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular/cli@11.1.4',
npm WARN EBADENGINE   required: { node: '>= 10.13.0', npm: '^6.11.0', yarn: '>= 1.13.0' },
npm WARN EBADENGINE   current: { node: 'v15.8.0', npm: '7.5.0' }
npm WARN EBADENGINE }

我们根据提示信息安装要求的版本:

$ npm -v
7.5.0

$ npm install --global npm@6

removed 60 packages, changed 194 packages, and audited 436 packages in 30s

3 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

$ npm -v
6.14.11

$ npm install -g @angular/cli
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
/usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng

> @angular/cli@11.1.4 postinstall /usr/local/lib/node_modules/@angular/cli
> node ./bin/postinstall/script.js

? Would you like to share anonymous usage data with the Angular Team at Google u
nder
Google’s Privacy Policy at https://policies.google.com/privacy? For more details
 and
how to change this setting, see http://angular.io/analytics. Yes

Thank you for sharing anonymous usage data. If you change your mind, the following
command will disable this feature entirely:

    ng analytics off

+ @angular/cli@11.1.4
added 5 packages from 2 contributors, removed 7 packages and updated 234 packages in 103.594s

OK 我们查看以下版本

$ ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 11.1.4
Node: 15.8.0
OS: darwin x64

Angular: 
... 
Ivy Workspace: 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1101.4 (cli-only)
@angular-devkit/core         11.1.4 (cli-only)
@angular-devkit/schematics   11.1.4 (cli-only)
@schematics/angular          11.1.4 (cli-only)
@schematics/update           0.1101.4 (cli-only)    
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐