首页 > 解决方案 > 我已经在我的系统上安装了 NODEjs,但是当我检查 nodejs 版本时,它没有给我版本。我应该怎么办?

问题描述

$ sudo apt install nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  nodejs
1 upgraded, 0 newly installed, 0 to remove and 38 not upgraded.
Need to get 24.7 MB of archives.
After this operation, 111 kB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_14.x focal/main amd64 nodejs amd64 14.8.0-deb-1nodesource1 [24.7 MB]
Fetched 24.7 MB in 20s (1,246 kB/s)                                            
(Reading database ... 155976 files and directories currently installed.)
Preparing to unpack .../nodejs_14.8.0-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (14.8.0-deb-1nodesource1) over (14.7.0-deb-1nodesource1) ...
Setting up nodejs (14.8.0-deb-1nodesource1) ...
Processing triggers for man-db (2.9.1-1) ...

$ nodejs -v

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

sudo apt install nodejs

我在那之前用过这些命令

curl -sL https://deb.nodesource.com/setup_14.x | bash - apt-get install -y nodejs

标签: node.jsnodejs-server

解决方案


用这个命令检查

node -v或者node –version


推荐阅读