我在google上搜索如何显示节点js的版本或者我将如何使用npm?如果我这样做
npm -v
Run Code Online (Sandbox Code Playgroud)
即使我已经使用它安装它brew install node.结果总是如此
env: node: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我已经做了很多命令来解决它,但失败了.这些是我已经尝试过的命令:
sudo apt-get install nodejs-legacy
sudo ln -s /usr/local/bin/node /usr/bin/node
brew unlink node
brew link node
Run Code Online (Sandbox Code Playgroud)
因此,我无法开始这项任务.帮帮我们 这项工作在我使用此命令之后brew link --overwrite node.现在我有问题了,我不能再和npm一起工作了.我真的很陌生.我现在对如何解决这个问题一无所知.
更新
我已经使用npm list命令获取列表了.我也在这里得到了想法链接,但当我npm install在项目内部时.我总是得到这个"结果env:节点:没有这样的文件或目录",即使我命令npm -v但是如果我在我的项目之外命令它.它适用于npm -v
小智 58
我这样解决了:
$ brew uninstall --force node
$ brew uninstall --force npm
Run Code Online (Sandbox Code Playgroud)
在它之后
$ brew install node
Run Code Online (Sandbox Code Playgroud)
这建议我覆盖simlinks
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/doc/node/gdbinit
Target /usr/local/share/doc/node/gdbinit
already exists. You may want to remove it:
rm '/usr/local/share/doc/node/gdbinit'
To force the link and overwrite all conflicting files:
brew link --overwrite node
Run Code Online (Sandbox Code Playgroud)
执行后
$ brew link --overwrite node
Run Code Online (Sandbox Code Playgroud)
一切都恢复了.
Kin*_*oad 38
注意:只有mac用户!
curl -ksO https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh
chmod +x ./uninstall-node.sh
./uninstall-node.sh
rm uninstall-node.sh
或者您可以查看此网站:如何完全卸载Node.js,并从头重新安装(Mac OS X)
如果这不起作用,则需要通过控制面板或任何其他方法删除节点.只要它被删除.
如果您使用nvm,您可以使用:
nvm install node
您已经可以检查它是否有效,然后您不需要执行以下步骤:npm -v然后node -v
如果你已经nvm安装:
command -v nvm
sudo npm uninstall npm -g
或者,如果失败,请获取npm源代码,并执行以下操作:
sudo make uninstall
如果已nvm安装,则使用:nvm uninstall npm
npm install -g grunt小智 16
感谢这个论坛。下面分享我的笔记。
macOS Monterey 版本 12.2.1 芯片 Apple M1
$ brew uninstall --force node
$ brew uninstall --force npm
$ brew install node
$ brew link --overwrite node
$ brew doctor
$ brew cleanup
$ nvm --version
// 0.35.3
$ nvm use stable
// Now using node v17.6.0 (npm v8.5.1)
$ node -v
// v17.6.0
$ npm -v
// 8.5.1
Run Code Online (Sandbox Code Playgroud)
RAM*_*237 15
env: node: No such file or directory通过 Jenkins 运行作业时出现此错误。
我做了什么来修复它 -export PATH="$PATH:"/usr/local/bin/在 Jenkins 作业执行的脚本的开头添加。
我用 brew 升级我的节点版本后遇到了这样的问题。解决问题
1) 运行$brew doctor检查是否安装成功 2) 如果您之前没有清除任何与节点相关的文件,可能会弹出这样的错误日志:
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built.
node
3) 现在建议您运行 brew link 命令删除原有节点相关文件并覆盖新文件 - $ brew link node.
就是这样 - 一切又正常了!!!
| 归档时间: |
|
| 查看次数: |
57377 次 |
| 最近记录: |