`没有这样的文件或目录`在npm中安装js美化时

`no such file or directory` While installing js beautify in npm

我在使用 npm -g install js-beautify

时遇到此错误
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

JS-Beautify 1.7.0 is broken.

明确安装最后一个好版本:

npm -g install js-beautify@1.6.14

...或者等待修复版本发布。

我的解决方法是添加到 package.json:

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

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

然后删除node_modules/目录

并最终使用 npm install 重新安装所有依赖项(由于某种原因纱线会失败 - 即使在删除 yarn.lock 之后)