(1)注意項1:wins10安裝最好選擇msi包,而不是zip包
剛開始下載zip包,在wins10下面的環境變量進行設置,管理員模式開啓cmd,輸入node -v之後,提示沒有安裝成功,最後還是去下載了msi的版本:
https://nodejs.org/download/release/v10.16.0/
(2)注意項2:安裝好之後,執行npm i -g @vue/cli報錯
報錯內容:
npm ERR! code EINTEGRITY
npm ERR! sha512-Pspx3oKAPJtjNwE92YS05HQoY7z2SFyOpHo9MqJor3BXAGNaPUs83CuVp9VISFkSjyRfiTpmKuAYGJB7S7hOxw== integrity checksum failed when using sha512: wanted sha512-Pspx3oKAPJtjNwE92YS05HQoY7z2SFyOpHo9MqJor3BXAGNaPUs83CuVp9VISFkSjyRfiTpmKuAYGJB7S7hOxw== but got sha512-DWlXNFfeMNW6dNNN3+ynTxZks1dDUS/8s6rMKevxmpPZ8tLrGhiIxKzXLhi5nsySIUHUZARlPmDh8eO84RWyMQ==. (4782538 bytes)
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ccs\AppData\Roaming\npm-cache\_logs\2020-07-02T15_19_08_942Z-debug.log
解決方式
如果不能通過https fetch:
$ npm config set registry http://registry.npmjs.org/
$ npm config set strict-ssl false
最好的解決方式–使用淘寶源
鏡像使用方法(三種辦法任意一種都能解決問題,建議使用第三種,將配置寫死,下次用的時候配置還在):
1.通過config命令
$ npm config set registry https://registry.npm.taobao.org
$ npm info underscore (如果上面配置正確這個命令會有字符串response)
2.命令行指定
$ npm --registry https://registry.npm.taobao.org info underscore
3.編輯 ~/.npmrc 加入下面內容
$ registry = https://registry.npm.taobao.org
(3)參考
使用NPM命令安裝庫時,遇到 npm ERR! fetch failed https://registry.npmjs.org/xxx的問題:https://blog.csdn.net/yypsober/article/details/51906616