提前在E:\nodejs文件夹下建立node_gobal和node_cache
并配置环境变量NODE_PATH:E:\nodejs\node_global\node_modules
改变用户变量中的C:\Users\11872\AppData\Roaming\npm为 E:\nodejs\node_global
打开cmd
C:\Users\11872>npm config set prefix "E:\nodejs\node_global"
C:\Users\11872>npm config set cache "E:\nodejs\node_cache"
C:\Users\11872>npm config set registry=http://registry.npm.taobao.org
上面三步执行完成后,到用户 C:\Users\你的用户名\.npmrc查看是否存在上面三个指令
接着执行
C:\Users\11872>npm install webpack -g
E:\nodejs\node_global\webpack -> E:\nodejs\node_global\node_modules\webpack\bin\webpack.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\webpack\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ webpack@4.35.0
added 324 packages from 199 contributors in 66.87s
C:\Users\11872>npm install webpack-cli -g
E:\nodejs\node_global\webpack-cli -> E:\nodejs\node_global\node_modules\webpack-cli\bin\cli.js
npm WARN webpack-cli@3.3.5 requires a peer of webpack@4.x.x but none is installed. You must install peer dependencies yourself.
+ webpack-cli@3.3.5
added 206 packages from 130 contributors in 26.024s
C:\Users\11872>webpack -v
4.35.0
C:\Users\11872>npm install vue-cli -g
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
E:\nodejs\node_global\vue -> E:\nodejs\node_global\node_modules\vue-cli\bin\vue
E:\nodejs\node_global\vue-init -> E:\nodejs\node_global\node_modules\vue-cli\bin\vue-init
E:\nodejs\node_global\vue-list -> E:\nodejs\node_global\node_modules\vue-cli\bin\vue-list
+ vue-cli@2.9.6
added 239 packages from 206 contributors in 65.166s
C:\Users\11872>vue -V 检查vue-cli版本号 vue -V ,此处V为大写
切换到存放vue项目的盘符下
C:\Users\11872>e:
E:\>cd test
E:\test>vue init webpack myvue
? Project name myvue
? Project description A Vue.js project
? Author 1187253007 <1187253007@qq.com>
? Vue build standalone
? Install vue-router? Yes
? Use ESLint to lint your code? No
? Set up unit tests Yes
? Pick a test runner jest
? Setup e2e tests with Nightwatch? Yes
? Should we run `npm install` for you after the project has been created? (recommended) npm
vue-cli · Generated "myvue".
# Installing project dependencies ...
# ========================
npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated bfj-node4@5.3.1: Switch to the `bfj` package for fixes and new features!
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
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
> chromedriver@2.46.0 install E:\test\myvue\node_modules\chromedriver
> node install.js
Current existing ChromeDriver binary is unavailable, proceding with download and extraction.
Downloading from file: https: