zoukankan      html  css  js  c++  java
  • 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:UsersAdministratorAppDataRoamingSublime Text 2Packages目录下
    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:in ode.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:UsersAdministratorAppDataRoamingSublime Text 2Packages odejsNodejs.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。
  • 相关阅读:
    今天不谈技术,谈感情~
    外派金融公司
    OAuth2-简介
    Zookeeper实战-分布式锁
    Zookeeper-基础
    Minio-对象存储
    Redis实战-BloomFilter
    Redis实战-详细配置-优雅的使用Redis注解/RedisTemplate
    Redis-基础
    SpringBoot-表单验证-统一异常处理-自定义验证信息源
  • 原文地址:https://www.cnblogs.com/kekeSummer/p/5291706.html
Copyright © 2011-2022 走看看