简体   繁体   English

安装 react-router-dom 时遇到错误

[英]Encounter error when installing react-router-dom

I get this error whenever I NPM install react-router-dom in vs code:每当我 NPM 在 vs 代码中安装 react-router-dom 时,我都会收到此错误:

在此处输入图片说明

npm ERR! npm 错误! Unexpected end of JSON input while parsing near '...stack-launcher":"^1.0'在 '...stack-launcher":"^1.0' 附近解析时 JSON 输入意外结束

npm ERR! npm 错误! A complete log of this run can be found in: npm ERR!可以在以下位置找到此运行的完整日志:npm ERR!
C:\\Users\\HP\\AppData\\Roaming\\npm-cache_logs\\2019-03-18T09_03_43_417Z-debug.log C:\\Users\\HP\\AppData\\Roaming\\npm-cache_logs\\2019-03-18T09_03_43_417Z-debug.log

This solved it for me 这为我解决了

npm cache clean --force

then run 然后跑

npm i react-router-dom

Seems like you missed a comma after '...stack-launcher":"^1.0' in the package.json file. 似乎您在package.json文件中的'...stack-launcher":"^1.0'之后错过了逗号。

If not delete the node_modules folder, delete package-lock.json file, run npm cache clean --force and try to re-install. 如果不删除node_modules文件夹,删除package-lock.json文件,运行npm cache clean --force并尝试重新安装。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM