注意:做下面這些步驟以前,我可是把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)