Node.js checksum failed 错误解决方案
问题
在某个项目内npm install时,老是报以下错误:
pm ERR! code EINTEGRITY npm ERR! sha1-7Qoe24fAXU2xA3xfj0g9ijtfCCU= integrity checksum failed when using sha1: wanted sha1-7Qoe24fAXU2xA3xfj0g9ijtfCCU= but got sha512-mYQLZnx5Qt1JgB1WEiMCf2647plpGeQ2NMR/5L0HNZzGQo4fuSPnK+wjfPnKZV0aiJDgzmWqqkV/g7JD+DW0qw== sha1-psC74fOPOqC5Ijjstv9Cw0TUE10=. (1511 bytes)
npm ERR! A complete log of this run can be found in: npm ERR! /Users/acer/.npm/_logs/2019-03-09T14_42_43_549Z-debug.log 安装 create-nuxt-app@latest 失败,错误代码:1
意思大概就是包的md5对不上,无法安装。
如何解决
一番摸索后,发现是我自己给npm set config registry 更改了源。改回官方的npm源就能解决问题:
npm config set registry https://registry.npmjs.org
或
npm config set registry https://registry.npm.taobao.org