美文网首页
快速安装 Node.js 并初始化 Express 应用

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

作者: Rapp | 来源:发表于2017-11-20 15:16 被阅读37次
    1. 安装 Node Version Manager
    • 下载并运行安装脚本
    $ 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

    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. 安装 nodemon
    $ npm install -g nodemon
    
    1. 安装 Express application generator
    $ npm install -g express-generator
    
    1. 初始化 Express 项目
    $ git clone https://github.com/bioxfu/WebDev
    $ bash WebDev/express_init.sh
    
    1. 运行 Express app
    $ nodenom
    

    相关文章

      网友评论

          本文标题:快速安装 Node.js 并初始化 Express 应用

          本文链接:https://www.haomeiwen.com/subject/dbnmvxtx.html