2017-09-18 30 views
8

當我使用我得到這個錯誤npm -g install js-beautify`沒有這樣的文件或directory`在安裝JS美化NPM

npm ERR! path /home/developer/software/nodejs/lib/node_modules/js- 
beautify/js/bin/css-beautify.js 
npm ERR! code ENOENT 
npm ERR! errno -2 
npm ERR! syscall chmod 
npm ERR! enoent ENOENT: no such file or directory, chmod 
'/home/developer/software/nodejs/lib/node_modules/js- 
beautify/js/bin/css-beautify.js' 
npm ERR! enoent This is related to npm not being able to find a file. 
npm ERR! enoent 

npm ERR! A complete log of this run can be found in: 
npm ERR!  /home/developer/.npm/_logs/2017-09-18T07_52_38_910Z- 
debug.log 

可以做些什麼來解決這個問題?

我使用節點8.5.0的NPM 5.3.0

+0

或添加包lock.json臨時修復的https:/ /stackoverflow.com/a/46282382/1910007 – Bunker13

回答

17

JS-Beautify 1.7.0 is broken

顯式安裝的最後一個版本好:

npm -g install [email protected] 

...或者等待被釋放了固定的版本。

+0

這在當前的npm版本中適用於我。謝謝! – Ragas

+0

@Ragas這是因爲在js-beautify FYI – kisanme

+0

的全球安裝中可能會破壞另一個新項目使用此修補程序的最新版本發生故障https://stackoverflow.com/questions/46275969/npm-install-and-npm -run-dev-giving-error/46282382#46282382 – Bunker13

-1

添加這爲的package.json臨時修復

"dependencies": { 
    "js-beautify": "1.6.14" 
} 
+1

package.json是什麼?問題在於詢問如何在全球範圍內安裝它。 – Quentin

+0

@Quentin我沒有看過描述,只專注於js-beautify發佈失敗的新版本。此修復程序適用於使用vue的用戶,特別是使用帶有vue-loader的webpack。 –

0

對我來說,倫敦定盤添加到package.json

"devDependencies": { "js-beautify": "1.6.14",

"resolutions": { "js-beautify": "1.6.14" }

然後刪除th Ënode_modules/目錄

和finaly重新安裝所有使用npm install的依賴關係(由於某種原因,紗線會失敗 - 甚至刪除yarn.lock後)

相關問題