【发布时间】:2012-02-07 10:47:58
【问题描述】:
我在为 jshint 安装命令行界面时遇到问题。我已经删除了节点,安装了 home brew 然后重新安装了最新版本的节点,但我仍然收到错误,见下文。
npm ERR! Error: ENOENT, no such file or directory '/usr/local/lib/node_modules/jshint/bin/hint'
npm ERR! You may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR!
npm ERR! System Darwin 10.8.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "jshint"
npm ERR! cwd /Users/macintosh/Dropbox/Sites/2012/Jan/Template/Assets/Scripts/Lint
npm ERR! node -v v0.6.10
npm ERR! npm -v 1.1.0-3
npm ERR! path /usr/local/lib/node_modules/jshint/bin/hint
npm ERR! code ENOENT
npm ERR! message ENOENT, no such file or directory '/usr/local/lib/node_modules/jshint/bin/hint'
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/macintosh/Dropbox/Sites/2012/Jan/Template/Assets/Scripts/Lint/npm-debug.log
npm not ok
这可能是权限问题吗?提前致谢
【问题讨论】:
-
第一个消息是“没有这样的文件或目录'/usr/local/lib/node_modules/jshint/bin/hint'”。您是说文件 确实 存在并且权限允许读取它吗?执行
ls -l /usr/local/lib/node_modules/jshint/bin/hint以查看文件权限。如果您仍然需要帮助,请使用输出编辑您的问题。祝你好运。 -
感谢您的回复。我运行了那段代码,它输出了
/usr/local/lib/node_modules/jshint/bin/hint: No such file or directory -
所以这不是权限问题,文件(可能是整个目录结构)丢失了。继续发出
ls -l /usr/local/lib/node_modules/jshint/bin并从上面一次删除 1 个目录,直到您获得目录列表。然后您就知道自己做了什么,这将帮助您找出安装时失败的原因。可能是您没有权限安装到 /usr/local/lib。祝你好运。 -
感谢您的帮助!我认为我的终端今天过得很糟糕,我回溯到
node_modulesdir 并重新安装了 jshint,它现在运行良好。
标签: node.js command-line npm jshint