我不断收到“env: node: No such file or directory”在 Eclipse 上运行 Grunt 作为 MacOS Yosemite 下的外部工具
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30630211/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
I keep getting "env: node: No such file or directory" running Grunt on Eclipse as an external tool under MacOS Yosemite
提问by Bienvenido Velez
Eclipse (Luna) is clearly launching grunt as the external build tool. However, the Eclipse console keeps showing the "env: node: No such file or directory" message and the grunt tasks do not get to run.
Eclipse (Luna) 显然将 grunt 作为外部构建工具启动。但是,Eclipse 控制台不断显示“env: node: No such file or directory”消息,并且 grunt 任务无法运行。
I can successfully run grunt on the command line (outside Eclipse) after moving to the project directory.
移动到项目目录后,我可以在命令行(Eclipse 外部)上成功运行 grunt。
The node installer did place it on /usr/local/bin/node but apparently grunt is expecting it somewhere else.
节点安装程序确实将它放在 /usr/local/bin/node 上,但显然 grunt 正在其他地方期待它。
Suggestions?
建议?
回答by heLL0
if you are using Homebrew try
如果你使用 Homebrew 试试
brew unlink node
then
然后
brew link node
回答by Bienvenido Velez
I discovered that grunt is apparently expecting node to live on /usr/bin
, yet the installer placed it on /usr/local/bin
.
我发现 grunt 显然希望 node 继续存在/usr/bin
,但安装程序将它放在/usr/local/bin
.
Solution:
解决方案:
sudo ln -s /usr/local/bin/node /usr/bin/node
Hope helps.
希望有所帮助。
回答by Kent Primrose
The "External Tools Configurations" dialog has a tab for setting the environment the command will run in. In this tab, press "Select..." and select "PATH...". Once it's there you can edit the Value to append ":/usr/local/bin". After this both "node" and "npm" are found and commands work just fine.
“外部工具配置”对话框有一个选项卡,用于设置命令将在其中运行的环境。在此选项卡中,按“选择...”并选择“路径...”。一旦它在那里,您可以编辑值以附加“:/usr/local/bin”。在此之后,“节点”和“npm”都被找到,命令工作得很好。
回答by Aymon Fournier
sudo chown -R $USER /usr/local
brew unlink node
brew link node