2017-09-12 39 views
1

我已成功安裝角度CLI但是當我運行此命令「NG新對myApp」它給出錯誤出錯創建新的角度4項目

「NG不被識別爲一個內部或外部命令」 當我運行此命令 「」

+-- @angular/[email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
+-- [email protected] 
`-- [email protected] 

錯誤給出如下

npm ERR! peer dep missing: [email protected]^5.0.1, required by @angular/[email protected] 
npm ERR! missing: [email protected]^1.4.1, required by [email protected] 
npm ERR! missing: [email protected]^1.8.3, required by [email protected] 
npm ERR! missing: [email protected]^1.0.2, required by [email protected] 
npm ERR! missing: [email protected]^1.0.0, required by [email protected] 
npm ERR! missing: [email protected]^4.0.3, required by [email protected] 
npm ERR! missing: [email protected], required by [email protected] 
npm ERR! missing: [email protected], required by [email protected] 
npm ERR! missing: [email protected], required by [email protected] 
npm ERR! missing: [email protected], required by s[email protected] 
npm ERR! missing: [email protected], required by [email protected] 
npm ERR! missing: [email protected]^7.1.1, required by [email protected] 
npm ERR! missing: [email protected]^7.1.1, required by [email protected] 
npm ERR! missing: [email protected]~1.0.9, required by [email protected] 
npm ERR! missing: [email protected]~0.3.2, required by [email protected] 
npm ERR! missing: [email protected]~0.1.3, required by [email protected] 
npm ERR! missing: [email protected]~1.0.0, required by [email protected] 
npm ERR! missing: [email protected]~1.0.2, required by [email protected] 
npm ERR! missing: [email protected]~1.0.1, required by [email protected] 
npm ERR! missing: [email protected]~1.0.2, required by [email protected] 
npm ERR! missing: [email protected]~1.0.1, required by [email protected] 
npm ERR! missing: [email protected]~2.0.2, required by [email protected] 
npm ERR! missing: [email protected]~1.5.4, required by [email protected] 
npm ERR! missing: [email protected]~1.1.10, required by [email protected] 
npm ERR! missing: [email protected]~1.0.3, required by [email protected] 
npm ERR! missing: [email protected]~1.0.0, required by [email protected] 
npm ERR! missing: [email protected]~1.2.9, required by [email protected] 
npm ERR! missing: [email protected]~1.0.8, required by [email protected] 
npm ERR! missing: [email protected]~1.1.1, required by [email protected] 
npm ERR! missing: [email protected]~1.4.0, required by [email protected] 
npm ERR! missing: [email protected]~1.0.2, required by [email protected] 
npm ERR! missing: [email protected]~7.0.6, required by [email protected] 
npm ERR! missing: [email protected]~2.1.5, required by [email protected] 
npm ERR! missing: [email protected]~1.9.4, required by [email protected] 
npm ERR! missing: [email protected]~1.0.1, required by [email protected] 
npm ERR! missing: [email protected]~4.0.1, required by [email protected] 
npm ERR! missing: [email protected]~3.6.0, required by [email protected] 
npm ERR! missing: [email protected]~3.0.6, required by [email protected] 
npm ERR! missing: [email protected]~3.0.2, required by [email protected] 
npm ERR! missing: [email protected]~1.0.2, required by [email protected] 
npm ERR! missing: [email protected]~1.0.7, required by [email protected] 
npm ERR! missing: [email protected]~4.1.0, required by [email protected] 
npm ERR! missing: [email protected]~7.2.1, required by [email protected] 
npm ERR! missing: [email protected]~0.1.5, required by [email protected] 
npm ERR! missing: [email protected]~2.0.4, required by [email protected] 
npm ERR! missing: [email protected]~1.0.0, required by [email protected] 
npm ERR! missing: [email protected]~4.0.3, required by [email protected] 
npm ERR! missing: [email protected]~2.1.5, required by [email protected] 

我該如何解決呢?可能是什麼問題?

回答

1

我認爲問題始於節點安裝。 使用

node -v 
npm -v 

節點必須是最新版本,請檢查節點版本爲v8.5.0和NPM必須是最新版本5.4.1

那麼請使用

npm install -g @angular/cli 

然後重新安裝角CLI檢查版本

ng -v 

版本將是1.4.1,如果一切正常,你可以創建

ng new myNewProject 
+0

對於節點JS安裝,請查看https://nodejs.org/en/download/ –

+0

對於節點6.9.0或更高版本以及NPM 3或更高版本的角度CLI要求。 –

+0

我目前的節點版本是v6.10.0我如何更新節點? –

0

你應該在訂單直接調用納克命令全局安裝角客戶機的項目,請運行:

npm install -g @angular/cli 
0

更新或安裝角度CLI包用下面的命令:

c:\ npm install -g @angular/cli 

後,通過以下命令在所需的位置創建一個新項目:

c:\ npm new projectName 
相關問題