注意:做下面这些步骤以前,我可是把c盘的npm全删了
尤其是 C:\Users\Administrator\AppData\Roaming\npm
还有一些之前安装过的清理缓存可能清理不干净,只能重新造个环境
我就把本地仓库全部放在E盘,安装以后的结果:
开始操作:
下载到本地
运行-next
一路next - install finish
默认npm的本地仓库在C盘下,移到nodejs安装目录
npm config set prefix "E:\Program Files (x86)\nodejs\node_global"
npm config set cache "E:\Program Files (x86)\nodejs\node_cache"
查看配置
npm config list
配置镜像
npm config set registry=http://registry.npm.taobao.org
看能否获取vue的信息
npm info vue
全局下npm新包
注意,此时,默认的模块E:\Program Files (x86)\nodejs\node_modules\
目录将会改变为目录E:\Program Files (x86)\nodejs\node_global\node_modules
如果直接运行npm install等命令会报错的。
增加环境变量NODE_PATH 内容是:E:\Program Files (x86)\nodejs\node_global\node_modules
安装vue
vue脚本在自定义的global目录下,需添加到环境变量
对path环境变量添加E:\Program Files (x86)\nodejs;E:\Program Files (x86)\nodejs\node_global
安装vue脚手架 vue 2.9.6
npm install vue -g
npm install vue-cli -g
vue -V
参考学习:https://blog.csdn.net/yt_php/article/details/90105880
https://www.cnblogs.com/goldlong/p/8027997.html
$ npm install
> [email protected] install D:\0 work\source\华夏娱乐系统\node_modules\yorkie
> node bin/install.js
▒ܾ▒▒▒▒ʡ▒
npm WARN notsup Unsupported engine for [email protected]: wanted: {
"npm":"^1.4.6","node":"^0.10"} (current: {
" node":"12.13.1","npm":"6.12.1"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {
"os":"dar win","arch":"any"} (current: {
"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node bin/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-12-06T01_24_52_151Z-debug.log
解:Unsupported platform for [email protected]: wanted {
"os":"dar win","arch":"any"} (current: {
"os":"win32","arch":"x64"})
原因: fsevent是mac osx系统的,在win或者Linux下使用了 所以会有警告,忽略就好了,意思就是你已经安装成功了,之后npm run dev即可
NPM依赖包版本号~和^的区别
~会匹配最近的小版本依赖包,比如~1.2.3会匹配所有1.2.x版本,但是不包括1.3.0
^会匹配最新的大版本依赖包,比如^1.2.3会匹配所有1.x.x的包,包括1.3.0,但是不包括2.0.0
控制面板先去卸载之前的
下载node 0.10
npm升级到指定版本
$ npm install -g [email protected]
npm http GET https://registry.npm.taobao.org/npm/1.4.6
npm http 200 https://registry.npm.taobao.org/npm/1.4.6
npm http GET https://registry.npm.taobao.org/npm/download/npm-1.4.6.tgz
npm http 200 https://registry.npm.taobao.org/npm/download/npm-1.4.6.tgz
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
C:\Users\Administrator\AppData\Roaming\npm\npm -> C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No readme data.
npm WARN package.json [email protected] No readme data.
[email protected] C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm
WARN unmet dependency C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\cross-spawn requires lru-cache@ '^2.5.0' but will load
npm WARN unmet dependency C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\lru-cache,
npm WARN unmet dependency which is version 2.7.3
npm WARN unmet dependency C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\npm-request requires urllib@ '^2.8.0' but will load
npm WARN unmet dependency C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\urllib,
npm WARN unmet dependency which is version 2.34.1
npm WARN unmet dependency C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall requires agentkee palive@'^3.1.0' but will load
npm WARN unmet dependency C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\agentkeepalive,
npm WARN unmet dependency which is version 3.5.2
notsup Not compatible with your operating system or architecture: [email protected]
npm install
各种报错,宝宝要受不了了
我要搞一套能用的
先到控制面板把node卸载
点进去文件发现 C:\Users\Administrator\AppData\Roaming\npm\node_modules@vue 为空
没有vue我一直安装vue-cli
。。脑子瓦特了
npm WARN `git config --get remote.origin.url` returned wrong result (git://github.com/vue/cli)