Nodejs的安装随笔

一.      下载nodejs

  1. 1.百度nodejs官网,下载匹配的版本 https://nodejs.org/en/

二.      下载配置开发工具

  1. 下载 Sublime Text 2 http://www.sublimetext.com/
  2. 下载Nodejs插件,下载ZIP包 https://github.com/tanepiper/SublimeText-Nodejs
  3. 解压ZIP,重命名为Nodejs
  4. 将Nodejs复制到C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages目录下
  5. 重启Sublime Text 2 ->Tools-->Build System -->Nodejs
  6. 配置nodejs的path Preferences-->Package Setting-->Nodejs-->Default,附我的配置如下:
  7. {
  8.   // save before running commands
  9.   "save_first": true,
  10.   // if present, use this command instead of plain "node"
  11.   // e.g. "/usr/bin/node" or "C:\bin\node.exe"
  12.   "node_command": "D:\\tools\\nodejs\\node.exe",
  13.   // Same for NPM command
  14.   "npm_command": "D:\\tools\\nodejs\\npm.cmd",
  15.  
  16.   "expert_mode": true,
  17.  
  18.   "ouput_to_new_tab": false
  19. }
  20. C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\nodejs\Nodejs.sublime-build进行修改,附我修改内容如下:

{

"cmd": ["D:\\tools\\nodejs\\node.exe", "-p", "$file"],

 "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",

 "selector": "source.js",

  "shell":true,

  "encoding": "GB2312",

  "windows":

    {

     "cmd": ["D:\\tools\\nodejs\\node.exe", "$file"]

    },

   "linux":

    {

        "cmd": ["killall node; node", "$file"]

    }

  1. }
  2. 修改网络代理:npm config set proxy=http://proxy.xn.petrochina:8080
  3. 为npm默认选择http方式,不选用https: npm config set registry http://registry.npmjs.org

10. 配置镜像和代理的方法:https://segmentfault.com/a/1190000002589144

三.      新建Express站点

  1. 安装express :npm install -g express-generator
  2. 检查express是否安装成功,并检查其版本:express –V
  3. 在项目文件下安装express框架:express 文件夹名称
  4. 安装express依赖项:cd StoreWeb && npm install
  5. 试运行SET DEBUG=StoreWeb:* & npm start,对应端口为3000,在浏览器上访问localhost:3000,页面会显示welcome express。
posted @ 2016-03-18 13:33  kekeSummer  阅读(181)  评论(0)    收藏  举报