Ubuntu 18.04 LTS 安装 Node.js

  • 常用的 Ubuntu 配置 Node.js 教程出现大量的异常,最终采取一下办法完成安装。

添加 Node.js 的 PPA

  • 最新版
1
2
$ sudo apt-get install curl python-software-properties
$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
  • 最新长期支持版 (测试有效)
1
2
$ sudo apt-get install curl python-software-properties
$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

安装 Node.js

1
$ sudo apt-get install nodejs

核对安装信息

1
2
3
4
$ node -v
v10.15.3
$ npm -v
6.4.1

参考资料

  1. How to install Node.js and npm on Ubuntu 18.04
  2. How to Install Latest Node.js and NPM on Ubuntu with PPA
updatedupdated2023-01-302023-01-30
点击刷新