npm,node更新最新版本

1、錯誤場景:安裝vue插件的時候,報錯,提示安裝最新版本


npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Administrator.CE-20151109NQJC\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
npm ERR! node v10.15.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] dev: `NODE_ENV=normal parcel demo/index.html`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] dev script 'NODE_ENV=normal parcel demo/index.html'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the muse-ui package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     NODE_ENV=normal parcel demo/index.html
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs muse-ui
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls muse-ui
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     F:\frame\vue\muse-ui-master\npm-debug.log

2、查看版本

npm -v

3、安裝最新版本(全局)

npm install -g npm

4、安裝指定版本(@後面跟版本號)

npm -g install [email protected]

5、node版本升級

官網下載最新安裝包,安裝覆蓋

6、安裝另外一個包的時候,還是有報錯,

C:\Users\Administrator.CE-20151109NQJC\AppData\Roaming\npm
npm WARN deprecated [email protected]: Please use postcss-loader instead of autoprefixer-loader
npm WARN deprecated [email protected]: �  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update! 
npm ERR! Unexpected end of JSON input while parsing near '...ata-0.0.10.tgz"}},"0.'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator.CE-20151109NQJC\AppData\Roaming\npm-cache\_logs\2019-04-01T09_59_14_849Z-debug.log

錯誤原因分析

使用命令npm install xx安裝包的時候,默認是從npm的鏡像源服務器進行下載的,該服務器是放在國外,很容易安裝失敗,因此全局安裝nrm鏡像源管理器,nrm裏面存放了多個鏡像源服務器

npm isntall nrm -g

問題解決:

先清空緩存,再重新安裝

npm cache clearn --force

npm install

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章