【问题标题】:nodejs is already the newest version but node -v showing errornodejs 已经是最新版本,但是 node -v 显示错误
【发布时间】:2020-09-28 05:09:44
【问题描述】:

如果我在终端输入 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/ 文件夹的权限,我修复了这个问题,但我的节点无法正常工作...

【问题讨论】:

  • 是的,我正在使用 Ubuntu @JonasLochmann
  • @ShahidMulani 检查链接的问题,这是完全相同的问题
  • 我会检查您的建议@MarcosCasagrande,但仍然无法正常工作节点... :(
  • 奇怪,同样的问题,同样的操作系统。

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


【解决方案1】:

nodejs 包将 node 安装为 nodejs,因此运行 nodejs -v 应该可以工作。如果你不打算安装与 NodeJS 完全无关的 node 包,你可以将 node 链接到 nodejs:

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

【讨论】:

    猜你喜欢
    • 2014-10-23
    • 1970-01-01
    • 2021-10-23
    • 1970-01-01
    • 2016-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多