nodejs已经是最新版本,但是node -v显示错误

时间:2018-06-19 18:32:18

标签: node.js linux shell command-line ubuntu-18.04

如果我在终端中键入node -v,则显示以下错误

Command 'node' not found, but can be installed with:

sudo apt install nodejs

如果我尝试执行上述命令,则返回以下结果

Building dependency tree 

Reading state information... Done

nodejs is already the newest version (8.11.3-1nodesource1).

0 upgraded, 0 newly installed, 0 to remove and 24 not upgraded.

由于错误,我将更改/usr/bin/文件夹的权限,我已解决该问题,但我的节点无法正常工作...

1 个答案:

答案 0 :(得分:0)

nodejs软件包将node安装为nodejs,因此运行nodejs -v应该可以。如果您不打算安装与NodeJS完全无关的节点包,则可以将node链接到nodejs:

sudo ln -s /usr/bin/nodejs /usr/bin/node
相关问题