在这种情况下无法升级 nodejs

在这种情况下无法升级 nodejs

无论我怎么尝试,我最终还是选择了 nodejs 4.2.6。这是个笑话吗?

$ nodejs -v
v4.2.6

卸载后 4.2.6 又像病毒一样回来了

$ sudo apt-get install nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp libjs-inherits libjs-node-uuid libjs-underscore libuv1-dev
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 73 not upgraded.
Need to get 0 B/3 161 kB of archives.
After this operation, 13,2 MB of additional disk space will be used.
Selecting previously unselected package nodejs.
(Reading database ... 434000 files and directories currently installed.)
Preparing to unpack .../nodejs_4.2.6~dfsg-1ubuntu4.1_amd64.deb ...
Unpacking nodejs (4.2.6~dfsg-1ubuntu4.1) ...
Processing triggers for doc-base (0.10.7) ...
Processing 1 added doc-base file...
Registering documents with scrollkeeper...
Processing triggers for man-db (2.7.5-1) ...
Setting up nodejs (4.2.6~dfsg-1ubuntu4.1) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode

答案1

发生这种情况是因为 Ubuntu 默认提供了此版本的 node js。我安装时得到了一个类似的版本。

然后我跟着本指南。我可以安装最新版本。最好的方法是从下载二进制文件官方节点站点.然后解压该包并将其添加到系统路径位置。

相关内容