- 下載并運行安裝腳本
$ 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)
- 設(shè)置默認(rèn) 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