2017-10-09 19 views
0

我嘗試安裝node_module在我的角度項目,我下載了什麼,但我得到這個錯誤:NPM安裝錯誤 - 世邦魏理仕()從來沒有所謂的

npm ERR! registry error parsing json

然後我重裝NPM使用npm intall npm -g,當我嘗試使用後npm install我得到這個錯誤:

(node:11252) UnhandledPromiseRejectionWarning: Unhandled promise 
rejection (rejection id: 1): Error: ENOENT: no such file or directory, stat 
'C:\Users\User\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-ec5da46c\angular\cdk.es5.js' 

的debug.log:

0 info it worked if it ends with ok 
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', 
1 verbose cli 'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js', 
1 verbose cli 'install' ] 
2 info using [email protected] 
3 info using [email protected] 
4 verbose npm-session ff5ce249dfe37f0e 
5 silly install runPreinstallTopLevelLifecycles 
6 silly preinstall [email protected] 
7 info lifecycle [email protected]~preinstall: [email protected] 
8 silly install loadCurrentTree 
9 silly install readLocalPackageData 
10 silly install loadIdealTree 
11 silly install cloneCurrentTreeToIdealTree 
12 silly install loadShrinkwrap 
13 info lifecycle @angular/[email protected]~prepack: @angular/[email protected] 
14 error cb() never called! 
15 error This is an error with npm itself. Please report this error at: 
16 error <https://github.com/npm/npm/issues> 

我已經嘗試過npm cache clean --force但我得到相同的錯誤。

node -v v6.10.2 
npm -v 5.4.2 

回答

0

確保你有你的角項目,該項目應該與此類似的根內的package.json文件。

https://github.com/heroku/node-js-sample/blob/master/package.json

如果的package.json文件存在,運行npm install得到保存它的包裝,這將產生一個node_modules目錄給你。

但是,如果文件不存在,就意味着你必須通過運行npm i -y應該自動爲您創建一個文件的package.json和以及允許你安裝節點模塊初始化NPM到項目中。

注意:您已經在您的機器上安裝了npm,因此運行npm install npm -g並不理想。

+0

'package.json'存在,並且這個項目幾個星期前工作。但是現在我克隆git並得到這個錯誤。 – Vertigo

+0

確保它位於運行'npm install'的項目的根目錄下。 –

+0

我在根目錄下運行。現在我嘗試在其他計算機上安裝此項目,並且安裝了'node_modules',但我認爲'npm'中存在troublemm。你有什麼想法? – Vertigo