Mac -bash:节点:找不到命令 [英] Mac -bash: node: command not found

查看:208
本文介绍了Mac -bash:节点:找不到命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在从终端运行node.js时遇到问题.

I am having problems running node.js from the terminal.

我已经为Mac运行了node.js安装程序,但是当我尝试在终端中使用node命令时,出现以下错误:

I have run the node.js installer for mac, but when I try to use the node command in the terminal, I get the following error:

-bash: node: command not found

我一直在寻找解决方案,但是我发现的所有建议都帮不了

I have been trying to look for a solution but all the suggestions I found, dont help

在/usr/local/bin文件夹中,我有node和npm,但是即使导航到该文件夹​​并运行node,我仍然会遇到相同的错误.我不明白为什么会这样,因为我可以看到该节点存在于文件夹中.

In the folder /usr/local/bin I have node and npm, but even when I navigate to the folder and run node, I still get the same error. I don't understand why this is happening, because I can see that node exists in the folder.

我还尝试通过添加/usr/local/bin来编辑.bash_profile,但这也无法解决问题

I also tried to edit the .bash_profile by adding /usr/local/bin but that didn't resolve the issue either

任何建议将不胜感激! TIA!

Any suggestions would be greatly appreciated! TIA!

推荐答案

我找到了问题的原因.

我已经编辑了.bash_profile文件,以将其添加到JAVA的路径,但是我没有以冒号(:)结束它,因此它最终将JAVA的路径与/usr/local/bin组合在一起

I had edited the .bash_profile to add the path to JAVA but I did not end it with a colon (:) so it ended up combining the path to JAVA with /usr/local/bin

一旦我添加了冒号,一切就开始起作用

Once I added the colon, everything started working

这篇关于Mac -bash:节点:找不到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆