2016-02-28 54 views
0

我得到一個錯誤,當我在凌凌主編包安裝錯誤

npm ERR! Windows_NT 6.2.9200 
npm ERR! argv "C:\\Users\\Jarvis\\AppData\\Local\\atom\\app-1.5.3\\resources\\app\\apm\\bin\\node.exe" "C:\\Users\\Jarvis\\AppData\\Local\\atom\\app-1.5.3\\resources\\app\\apm\\node_modules\\npm\\bin\\npm-cli.js" "--globalconfig" "C:\\Users\\Jarvis\\.atom\\.apm\\.apmrc" "--userconfig" "C:\\Users\\Jarvis\\.atom\\.apmrc" "install" "C:\\Users\\Jarvis\\AppData\\Local\\Temp\\d-116128-3752-1lwywgv\\package.tgz" "--target=0.34.5" "--arch=ia32" 
npm ERR! node v0.10.40 
npm ERR! npm v2.13.3 
npm ERR! file C:\Users\Jarvis\.atom\.apm\nopt\3.0.6\package\package.json 
npm ERR! code EJSONPARSE 

npm ERR! Failed to parse json 
npm ERR! Unexpected token '\u0000' at 1:1 
npm ERR! 
npm ERR!^
npm ERR! File: C:\Users\Jarvis\.atom\.apm\nopt\3.0.6\package\package.json 
npm ERR! Failed to parse package.json data. 
npm ERR! package.json must be actual JSON, not just JavaScript. 
npm ERR! 
npm ERR! This is not a bug in npm. 
npm ERR! Tell the package author to fix their package.json file. JSON.parse 

安裝軟件包我試圖安裝大量的包在原子編輯器,但我得到上述錯誤。

回答

0

如果您使用Notpad ++(或您選擇的任何其他編輯器打開C:\Users\Jarvis\.atom\.apm\nopt\3.0.6\package\package.json - 只是不要在atom中執行,它會崩潰,至少在版本1.6.2中它會爲我執行)並查找不可打印字符。你會看到該文件包含很多NUL。有一天,我嘗試安裝我的軟件包更新時突然出現了相同的錯誤。

這是我做了什麼來解決這個錯誤。不過要注意的是,你必須重新安裝所有的軟件包。我個人使用同步設置(備份我的軟件包等),所以對我來說沒什麼大不了的。

  • 刪除整個C:\用戶\ Jarvis.atom \ Packages文件夾
  • 刪除entier C:\用戶\ Jarvis.atom.apm文件夾
  • 重新安裝所有的軟件包(.apm文件夾,然後將裝自動)

由於路徑太長限制,可能很難刪除這些文件夾。在這種情況下,這有助於Stackexchange答案:How to delete a file in Windows with a too long filename?