问题描述
我使用 sudo npm install create-react-app -g 时的错误npm 错误!Linux 4.13.0-39-通用npm 错误!argv "/usr/bin/node" "/usr/bin/npm" "i" "create-react-app" "-g"npm 错误!节点 v6.11.4npm 错误!npm v3.5.2
Errors when i use sudo npm install create-react-app -gnpm ERR! Linux 4.13.0-39-genericnpm ERR! argv "/usr/bin/node" "/usr/bin/npm" "i" "create-react-app" "-g"npm ERR! node v6.11.4npm ERR! npm v3.5.2
npm 错误!/tmp/npm-16477-77596b49/registry.npmjs.org/tar/-/tar-2.2.1.tgz shasum 检查失败npm 错误!预期:8e4d2a256c0e2185c6b18ad694aec968b83cb1d1npm 错误!实际:5eb06eb521673d0940a4deb11baf89d62647f193npm 错误!来自:https://registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! shasum check failed for /tmp/npm-16477-77596b49/registry.npmjs.org/tar/-/tar-2.2.1.tgznpm ERR! Expected: 8e4d2a256c0e2185c6b18ad694aec968b83cb1d1npm ERR! Actual: 5eb06eb521673d0940a4deb11baf89d62647f193npm ERR! From: https://registry.npmjs.org/tar/-/tar-2.2.1.tgz
使用 npm install create-react-app 时- npm 版本:6.0.0- 节点版本:8.11.1错误是:
npm 错误!解析 '...mojOzGIEI2rg0m24Yb5Oq' 附近时 JSON 输入意外结束
when use npm install create-react-app- npm-version : 6.0.0- node-version: 8.11.1error is:
npm ERR! Unexpected end of JSON input while parsing near '...mojOzGIEI2rg0m24Yb5Oq'
npm 错误!可以在以下位置找到此运行的完整日志:npm 错误!/home/dilipcoder/.npm/_logs/2018-05-05T11_34_14_721Z-debug.log
npm ERR! A complete log of this run can be found in:npm ERR! /home/dilipcoder/.npm/_logs/2018-05-05T11_34_14_721Z-debug.log
我已经尝试过这些选项
- npm 缓存清理 --force
- 重新安装 npm 和 node
- 切换不同版本的 npm
我在安装 create-react-app 其他软件包时遇到的错误
推荐答案
错误 npm ERR!shasum 检查失败 和 npm ERR!解析'....' 附近的 JSON 输入意外结束, 将通过从给定的 npm 注册表列表中切换 npm 注册表来解决.
the error npm ERR! shasum check failed and npm ERR! Unexpected end of JSON input while parsing near'....' , will be solved by switching npm reigistry from the list of given npm registry.
Npm 注册表列表:
- https://registry.npmjs.org/(错误一)
- http://r.cnpmjs.org/
- https://registry.npm.taobao.org/
- https://registry.nodejitsu.com/
- http://registry.mirror.cqupt.edu.cn
- https://skimdb.npmjs.com/registry
- https://npm.open-registry.dev/ (https://open-registry.dev)
- https://registry.npmjs.org/ (Dfault One)
- http://r.cnpmjs.org/
- https://registry.npm.taobao.org/
- https://registry.nodejitsu.com/
- http://registry.mirror.cqupt.edu.cn
- https://skimdb.npmjs.com/registry
- https://npm.open-registry.dev/ (https://open-registry.dev)
切换只需输入
npm 配置设置注册表https://registry.npmjs.com/"
用上述网址替换注册表网址,检查哪一个适合您.
Replace the registry url with the above urls check which one works for you.
在那之后:
npm 缓存清除 --force
npm 缓存验证
After That:
npm cache clear --force
npm cache verify
现在错误将被解决.
这篇关于安装 create-react-app 会导致 npm ERR!shasum 检查失败并且 npm ERR!在 '...mojOzGIEI2rg0m24Yb5Oq' 附近解析时 JSON 输入意外结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!