热门搜索 :
考研考公
您的当前位置:首页正文

快速安装 Node.js 并初始化 Express 应用

来源:东饰资讯网
  1. 安装
  • 下载并运行安装脚本
$ curl -o-  | 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

  1. Install the latest long-term support (LTS) version
$ nvm install --lts
$ node --version
$ npm --version
  1. 查看已安装的 node 版本
$ nvm ls
  1. 使用某一版本的 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)
  1. 设置默认 Node 版本
nvm alias default 8.9.1
  1. 安装
$ npm install -g nodemon
  1. 安装
$ npm install -g express-generator
  1. 初始化 项目
$ git clone 
$ bash WebDev/express_init.sh
  1. 运行 Express app
$ nodenom
Top