開發與維運

Ubuntu 安裝 NodeJS

為了省事兒,麻煩少,本文所有操作都是使用 ubuntu 用戶操作。

安裝 NodeJS

  1. 下載腳本

    curl -sL https://deb.nodesource.com/setup_15.x | sudo bash -

    如需安裝其他版本的 NodeJS,腳本下載地址可以在常用的 NodeJS 版本以及腳本下載地址中找到,替換上面命令中的 https://deb.nodesource.com/setup_15.x 即可。

  2. 更新可用包的列表

    sudo apt update
  3. 安裝 NodeJS

    sudo apt install nodejs

    中途會提示一個 Do you want to continue? [Y/n],直接回車就行。

  4. 確認是否安裝成功

    $ node -v
    v15.3.0
    $ npm -v
    7.0.14

附錄

目前常用的 NodeJS 版本以及腳本下載地址如下:

版本 腳本下載地址
Node.js 10 LTS https://deb.nodesource.com/setup_10.x
Node.js 12 LTS https://deb.nodesource.com/setup_12.x
Node.js 14 LTS https://deb.nodesource.com/setup_14.x
Node.js 15 https://deb.nodesource.com/setup_15.x

Title: Ubuntu 安裝 NodeJS

Date: 2020.12.01

Author: zhangpeng

Github: https://github.com/fullstack-zhangpeng

Leave a Reply

Your email address will not be published. Required fields are marked *