ubuntu 12.04上的nodejs vs node [英] nodejs vs node on ubuntu 12.04

查看:300
本文介绍了ubuntu 12.04上的nodejs vs node的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里的指令下在ubuntu上安装了nodejs a>

I installed nodejs on ubuntu from instructions given here

当我在终端写 node --version 时,我看到:

-bash:/ usr / sbin / node:没有这样的文件或目录

When I write node --version in the terminal I see this :
-bash: /usr/sbin/node: No such file or directory

我可以在 / usr / sbin / 目录。

npm --version 显示 1.3.5

nodejs --version 显示 v0.10.15

另外,我可以看到 / usr / bin /中的节点目录。

Also, I can see node in the /usr/bin/ directory.

那么,如何让节点工作?

此外,如果我使用 zsh 而不是bash,那么 node 命令可以正常工作。

Also, If I use zsh instead of bash, then node command works.

推荐答案

您需要手动创建符号链接 / usr / bin / node 。 bash兼容shell的快捷方式:

You need to manually create a symlink /usr/bin/node. Shortcut for bash compatible shells:

sudo ln -s `which nodejs` /usr/bin/node

或者如果您使用非标准shell,只需使用哪个nodejs

Or if you use non-standard shells, just hardcode the path you find with which nodejs:

sudo ln -s /usr/bin/nodejs /usr/bin/node

稍后修改

我找到了您发布的链接中的此解释

I found this explanation in the link you posted


与节点包(业余数据包无线电节点程序)和nodejs二进制文件存在命名冲突已从节点重命名为nodejs。您需要将/ usr / bin / node符号链接到/ usr / bin / nodejs,或者您可以卸载业余数据包无线节点程序以避免这种冲突。

There is a naming conflict with the node package (Amateur Packet Radio Node Program), and the nodejs binary has been renamed from node to nodejs. You'll need to symlink /usr/bin/node to /usr/bin/nodejs or you could uninstall the Amateur Packet Radio Node Program to avoid that conflict.

稍后编辑

自从我回答此问题已经有一段时间了。虽然我在这里发布的解决方案多次为我工作,但用户在评论中报告了更多解决方案:

It's been a while since I answered this. Although the solution I posted up here worked for me several times, users have reported a few more solutions within the comments:

来自@ user229115

From @user229115

sudo update-alternatives --install / usr / bin / node node / usr / bin / nodejs 10

来自AskUbuntu(用户leftium)

From AskUbuntu (user leftium)

sudo apt-get --purge remove node
sudo apt-get --purge remove nodejs
sudo apt-get install nodejs

这篇关于ubuntu 12.04上的nodejs vs node的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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