- 下载并运行安装脚本
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
$ nvm --version
Note: On Linux, after running the install script, if you get nvm: command not found
, simply close your current terminal, open a new terminal, and try verifying again. If it doesn't work, your system may not have a .bash_profile file where the command is set up. Simply create one with touch ~/.bash_profile
and run the install script again. If the above doesn't fix the problem, open your .bash_profile and add the following line of code: source ~/.bashrc
- Install the latest long-term support (LTS) version
$ nvm install --lts
$ node --version
$ npm --version
- 查看已安装的 node 版本
$ nvm ls
- 使用某一版本的 node
$ nvm use 8.9.1
Now using node v8.9.1 (npm v5.5.1)
$ nvm use 4.6.0
Now using node v4.6.0 (npm v2.15.9)
- 设置默认 Node 版本
nvm alias default 8.9.1
- 安装 nodemon
$ npm install -g nodemon
$ npm install -g express-generator
- 初始化 Express 项目
$ git clone https://github.com/bioxfu/WebDev
$ bash WebDev/express_init.sh
- 运行 Express app
$ nodenom