Ubuntu安装npm(nodejs)环境

一键安装脚本

#!/bin/bash
sudo apt-get -y install build-essential
cd /home
git clone https://github.com/cnpm/nvm.git
source /home/nvm/nvm.sh
echo "source /home/nvm/nvm.sh" >> ~/.bashrc
nvm install 10.16.3
nvm alias default v10.16.3

步骤说明

  1. 安装C/C++的编译环境
    sudo apt-get -y install build-essential
  2. 使用git下载mvn
    cd /home
    git clone https://github.com/cnpm/nvm.git
  3. 添加到环境变量中
    source /home/nvm/nvm.sh
    echo "source /home/nvm/nvm.sh" >> ~/.bashrc
  4. 查看最近 nodejs 稳定版本号,前往 nodejs 官网,查看稳定版本号。这里用v10.16.3
    nvm install 10.16.3
    nvm alias default v10.16.3
0%