NodeJs 在window中安装使用
Nodejs:
官网下载长期版本zip格式解压
D:\Program Files\nodejs
查看版本
D:\Git\SpringBootDemo (master) $ node -v v8.11.2 D:\Git\SpringBootDemo (master) $ npm -v 5.6.0
在此路径下建两个文件夹node_global和node_cache
更改npm全局模块和cache默认安装位置
D:\Git\SpringBootDemo (master) $ npm config set prefix "D:\Program Files\nodejs\node_global" D:\Git\SpringBootDemo (master) $ npm config set cache "D:\Program Files\nodejs\node_cache" D:\Git\SpringBootDemo (master) $ npm config get prefix D:\Program Files\nodejs\node_global D:\Git\SpringBootDemo (master) $ npm config get cache D:\Program Files\nodejs\node_cache
添加系统变量:
Path添加:
D:\Program Files\nodejs
D:\Program Files\nodejs\node_global
添加NODE_PATH
D:\Program Files\nodejs\node_global\node_modules
淘宝镜像:
D:\Program Files $ npm config set registry https://registry.npm.taobao.org D:\Program Files $ npm config get registry https://registry.npm.taobao.org/
通过cnpm使用:
D:\Program Files $ npm install -g cnpm --registry=https://registry.npm.taobao.org npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0 D:\Program Files\nodejs\node_global\cnpm -> D:\Program Files\nodejs\node_global\node_modules\cnpm\bin\cnpm + cnpm@6.0.0 added 917 packages in 35.536s D:\Program Files $ cnpm config get registry https://registry.npm.taobao.org/
安装最常用express模块:
D:\Git\SpringBootDemo (master) $ npm install express -g + express@4.16.3 added 50 packages in 6.291s D:\Git\SpringBootDemo (master) $ npm root -g D:\Program Files\nodejs\node_global\node_modules
安装vue脚手架:
D:\Program Files $ npm install --global vue-cli npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen) D:\Program Files\nodejs\node_global\vue -> D:\Program Files\nodejs\node_global\node_modules\vue-cli\bin\vue D:\Program Files\nodejs\node_global\vue-list -> D:\Program Files\nodejs\node_global\node_modules\vue-cli\bin\vue-list D:\Program Files\nodejs\node_global\vue-init -> D:\Program Files\nodejs\node_global\node_modules\vue-cli\bin\vue-init + vue-cli@2.9.6 added 252 packages in 19.487s D:\Program Files $ vue -V 2.9.6
安装vue-cli脚手架构建工具
vue-cli 提供一个官方命令行工具,可用于快速搭建大型单页应用。该工具提供开箱即用的构建工具配置,带来现代化的前端开发流程。只需几分钟即可创建并启动一个带热重载、保存时静态检查以及可用于生产环境的构建配置的项目:
$ npm install vue-cli -g
安装webpack
npm install webpack -g One CLI for webpack must be installed. These are recommended choices, delivered as separate packages: - webpack-cli (https://github.com/webpack/webpack-cli) The original webpack full-featured CLI. - webpack-command (https://github.com/webpack-contrib/webpack-command) A lightweight, opinionated webpack CLI. We will use "npm" to install the CLI via "npm install -D". Which one do you like to install (webpack-cli/webpack-command): npm install webpack-cli -g
开始安装webpack提示必须安装webpack-cli,然后再次安装webpack-cli
D:\Git $ webpack -v 4.11.0
https://nodejs.org/zh-cn/download/
https://blog.csdn.net/henery_002/article/details/78016575
http://www.cnblogs.com/PeunZhang/p/5629329.html
https://my.oschina.net/summerdays/blog/835233