npm install出错,npm ERR! code EINTEGRITY npm ERR! Verification failed while extracting url-parse@1.4.3

npm install时出现以下错误:

npm ERR! code EINTEGRITY
npm ERR! Verification failed while extracting url-parse@1.4.3:
npm ERR! Verification failed while extracting url-parse@1.4.3:
npm ERR! sha512-x95Td74QcvICAA0+qERaVkRpTGKyBHHYdwL2LXZm5t/gBtCB9KQSO/0zQgSTYEV1p0WcvSg79TLNPSvd5IDJMQ== integrity checksum failed when using sha512: wanted sha512-x95Td74QcvICAA0+qERaVkRpTGKyBHHYdwL2LXZm5t/gBtCB9KQSO/0zQgSTYEV1p0WcvSg79TLNPSvd5IDJMQ== but got sha512-rh+KuAW36YKo0vClhQzLLveoj8FwPJNu65xLb7Mrt+eZht0IPT0IXgSv8gcMegZ6NvjJUALf6Mf25POlMwD1Fw==. (13865 bytes)

npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersAdministratorAppDataRoamingnpm-cache_logs2018-09-15T10_18_02_420Z-debug.log

折腾许久,网上找了好多办法,有说npm版本太高了,要升级到最新的,有说因为更新包时一会用npm一会用cnpm导致的,其实我一直都只用npm,并且不管是清缓存还是升级npm后,都会把旧版本下载的文件目录都清空的。
清缓存:npm cache verify
运行:npm install -g npm
再运行:npm install -g vue-cli

还是一样不行,最后,把npm版本降为4.X后,再试,竟然可以了…..

npm -g install npm@4
npm cache verify
npm install

搞定~

原文地址:https://www.cnblogs.com/xiaocy66/p/10589290.html