创建新的Angular项目-软件包安装失败

时间:2019-10-21 09:34:20

标签: angular macos npm

Angular CLI: 8.3.8
Node: 10.16.3
OS: darwin x64
Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.803.8
@angular-devkit/core         8.3.8
@angular-devkit/schematics   8.3.8
@angular/cli                 8.3.8
@schematics/angular          8.3.8
@schematics/update           0.803.8

当我尝试创建一个新项目:ng new projectName时,出现以下错误:

  

npm错误!代码ETARGET   npm ERR!没有找到与@ angular-devkit / architect @ 0.803.12匹配的版本   npm ERR! notarget在大多数情况下,您或您的一个依赖项正在请求   npm ERR! notarget不存在的软件包版本。   npm ERR!没有目标   npm ERR! notarget它被指定为“ @ angular-devkit / build-angular”的依赖项   npm ERR!无目标

     

npm错误!可以在以下位置找到此运行的完整日志:   npm ERR! /Users/me/.npm/_logs/2019-10-21T08_48_20_226Z-debug.log   软件包安装失败,请参见上文。

这是包含以下内容的日志文件:

  

2488详细类型版本   2489详细堆栈@ angular-devkit / architect:未找到@ angular-devkit / architect @ 0.803.12的匹配版本。   pickManifest上的2489详细堆栈(/usr/local/lib/node_modules/npm/node_modules/npm-pick-manifest/index.js:122:13)   2489详细堆栈位于/usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/manifest.js:24:14   tryCatcher上的2489详细堆栈(/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)   Promise._settlePromiseFromHandler(/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:517:31)上的2489详细堆栈   Promise._settlePromise(/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:574:18)上的2489详细堆栈   Promise._settlePromiseCtx上的2489详细堆栈(/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:611:10)   _drainQueueStep处的2489详细堆栈(/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:142:12)   _drainQueue上的2489详细堆栈(/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:131:9)   Async._drainQueues(/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:147:5)上的2489详细堆栈   2489上的Instant.Async.drainQueues详细堆栈[作为_onImmediate](/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)   processImmediate上的2489详细堆栈(internal / timers.js:439:21)   2490详细的cwd / Users / me / AngularLab / myWorkSpace / projectName   2491详细的达尔文16.7.0   2492详细argv“ / usr / local / bin / node”“ / usr / local / bin / npm”“安装”“ --quiet”   2493详细节点v12.13.0   2494详细npm v6.12.0   2495错误代码ETARGET   2496错误Notarget没有找到@ angular-devkit / architect @ 0.803.12的匹配版本。   2497错误,没有目标在大多数情况下,您或您的一个依赖项正在请求   2497错误Notarget软件包版本不存在。   2497错误无目标   2497错误notarget它被指定为'@ angular-devkit / build-angular'的依赖项   2498详细出口[1,true]

有什么想法请问我要去哪里错了?

1 个答案:

答案 0 :(得分:0)

1.check node version
node -v

2.if not installed then follow the below 
Go to the Node.js Downloads page
Download Node.js for macOS by clicking the "Macintosh Installer" option
Run the downloaded Node.js .pkg Installer
Run the installer, including accepting the license, selecting the destination, and authenticating for the install.

3.check for npm
npm -v

4.install npm
npm install npm -g