env:节点:mac中没有这样的文件或目录 [英] env: node: No such file or directory in mac

查看:321
本文介绍了env:节点:mac中没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在google中搜索有关如何显示Node js版本或如何与npm一起使用的信息? 如果我这样做

I'm searching it in google on how to show the version of node js or how I'm gonna work with npm? If I do this

npm -v

即使我已经使用brew install node安装了它.结果总是

even I already install it using brew install node. The result is always

env: node: No such file or directory

我已经做了很多命令来解决它,但是失败了. 这些是我已经尝试过的命令:

I already do a lot of command to solve for it, but failed. these are the command that I already try:

sudo apt-get install nodejs-legacy
sudo ln -s /usr/local/bin/node /usr/bin/node
brew unlink node
brew link node

因此,我无法启动任务.帮帮我在使用此命令brew link --overwrite node之后,这项工作才开始.现在我有问题,我不能再使用npm了.我真的很新.我现在对如何解决这个问题一无所知.

I can't start the task because of this. help me guys. This work before after I used this command brew link --overwrite node. Now I have problem, i cant work anymore with npm. I'm really new about this. I don't have any idea now on how to fix this.

更新

我已经使用npm list命令获得了列表.我也在这里npm -v,但是如果我在我的项目之外命令它的话.它可以运行npm -v

I already get the list using npm list command. I also get the idea here link but when I npm install inside the project. I alwayst get this "result env: node: No such file or directory",even I command npm -v but If i command it outside my project. It work the npm -v

推荐答案

注意:仅Mac用户!

  1. 使用命令完全卸载节点

curl -ksO https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh
chmod +x ./uninstall-node.sh
./uninstall-node.sh
rm uninstall-node.sh

或者您可以访问以下网站:

Or you could check out this website: How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)

如果这不起作用,则需要通过控制面板或任何其他方法删除节点.只要将其移除.

if this doesn't work, you need to remove node via control panel or any other method. As long as it gets removed.

  1. 通过此网站安装节点: https://nodejs.org/en/download/

如果使用nvm,则可以使用:

If you use nvm, you can use:

nvm install node

您已经可以检查它是否有效,那么您无需执行以下步骤:npm -v然后node -v

You can already check if it works, then you don't need to take the following steps with: npm -v and then node -v

如果已安装nvm: command -v nvm

  1. 使用以下命令卸载npm:

sudo npm uninstall npm -g

或者,如果失败,则获取npm源代码,然后执行以下操作:

Or, if that fails, get the npm source code, and do:

sudo make uninstall

如果已安装nvm,请使用:nvm uninstall npm

If you have nvm installed, then use: nvm uninstall npm

  1. 使用以下命令安装npm:npm install -g grunt

这篇关于env:节点:mac中没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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