env:节点:mac中没有这样的文件或目录

编程入门 行业动态 更新时间:2024-10-28 04:25:18
本文介绍了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 install在项目内部时.我总是得到这个结果环境:节点:没有这样的文件或目录",即使我命令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用户!

  • 使用命令完全卸载节点
  • curl -ksO gist.githubusercontent/nicerobot/2697848/raw/uninstall-node.sh chmod +x ./uninstall-node.sh ./uninstall-node.sh rm uninstall-node.sh

    或者您可以访问以下网站:如何完全卸载Node.js,然后从头开始重新安装(Mac OS X)

    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.

  • 通过此网站安装节点: nodejs/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

  • 使用以下命令卸载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

  • 使用以下命令安装npm:npm install -g grunt
  • 更多推荐

    env:节点:mac中没有这样的文件或目录

    本文发布于:2023-10-26 01:02:04,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1528623.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:节点   文件   目录   env   mac

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!