2017-02-18 56 views
0

我現在有一個Angular2error問題。我收到一條消息angular-cli package.json在哪裏?

Cannot read property 'AssetUrl' of undefined

我看到了信息(Angular 2 - Cannot read property 'AssetUrl' of undefined)。我想編輯package.json。但是,我找不到這個文件。

我使用nodebrew來安裝node.js.

ng new app 

此命令導致此錯誤:

Cannot read property 'AssetUrl' of undefined

包文件還沒有被創建。

+0

嘗試卸載並清除npm緩存並再次安裝角度cli – Milad

+0

1stCommand [npm uninstall -g angular-cli] 2ndCommand [npm cache clean] 3rdCommand [npm install -g [email protected]] 4th [ng -v] displey char [不能讀取屬性'AssetUrl'的undefined]你知道其他的程序嗎? –

回答

0

看起來像你安裝了角度cli與舊命令npm install -g angular-cli,它與當前版本的節點或npm不兼容。

嘗試卸載舊版本並安裝一個新的名字:

npm uninstall -g angular-cli @angular/cli 
npm cache clean 
npm install -g @angular/[email protected] 

別忘了@符號,沒有它cli來開始有怪異的行爲。

+0

最新版本有錯誤(http://stackoverflow.com/questions/42053160/uncaught-referenceerror-ng-jsonp-req0-finished-is-not-defined-at)錯誤。我想使用angular-cli 1.0.0-beta.17。 –

+0

然後使用'npm install -g @ angular-cli @ 1.0.0-beta.17',因爲更新版本的節點 – Yevgen

+0

pakeageversion是[node -v 6.8.0] [npm -v 3.10.8] –