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! muse-ui@3.0.2 dev: `NODE_ENV=normal parcel demo/index.html`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the muse-ui@3.0.2 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 npm@6.9.0

5、node版本升级

官网下载最新安装包,安装覆盖

6、安装另外一个包的时候,还是有报错,

C:\Users\Administrator.CE-20151109NQJC\AppData\Roaming\npm
npm WARN deprecated autoprefixer-loader@3.2.0: Please use postcss-loader instead of autoprefixer-loader
npm WARN deprecated babel-preset-es2015@6.24.1: �  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

 

    原文作者:西洲 -
    原文地址: https://blog.csdn.net/xingmei_ok/article/details/88951925
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞