小编典典

安装reactjs时出错:解析附近时,JSON输入意外结束错误

reactjs

我尝试使用1)npx create-react-app my-app和2)在终端中使用两个不同的命令通过node安装reactjsnpx create-react-app app

但是两者都产生了如下所示的相同错误:

安装软件包。这可能需要几分钟。

使用cra-template安装react,react-dom和react-scripts …

npm ERR!解析’.... 1“,” object-hash“:” ^ 1’附近时,JSON输入意外结束

npm ERR!可以在以下位置找到此运行的完整日志:

npm ERR!C:\ Users \ David \ AppData \ Roaming \ npm-cache_logs \
2020-02-12T03_53_37_836Z-debug.log

中止安装。

npm install –save –save-exact –loglevel错误react react-dom react-scripts
cra模板已失败。

我尝试卸载并重新安装节点,还尝试安装不同版本的reactjs,但仍然遇到相同的错误。另外,我尝试清除节点缓存,然后通过再验证一次npm cache clear --forcenpm cache verify但仍然没有任何运气。任何帮助将不胜感激。

更详细的日志在底部显示:

203 silly saveTree`[email protected]

204详细的堆栈SyntaxError:解析’.... 1“,” object-hash“:” ^ 1’附近时,JSON输入意外结束

JSON.parse中的204详细堆栈()

parseJson的204详细堆栈(C:\ Program Files \ nodejs \ node_modules \ npm \
node_modules \ json-parse-Better-errors \ index.js:7:17)

204的详细堆栈位于C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \
node-fetch-npm \ src \ body.js:96:50

204在processTicksAndRejections处的详细堆栈(internal / process /
task_queues.js:97:5)

205详细的CWD C:\ Users \ David \ Desktop \ React \ my-app

206详细Windows_NT 10.0.17763

207详细argv“ C:\ Program Files \ nodejs \ node.exe”“ C:\ Program Files \
nodejs \ node_modules \ npm \ bin \ npm-cli.js”“安装”“ –save”“ –save-
确切”,“-loglevel”,“错误”,“反应”,“ react-dom”,“反应脚本”,“ cra-template”

208个详细节点v13.8.0

209详细npm v6.13.6

210错误解析’.... 1“,” object-hash“:” ^ 1’附近时,JSON输入意外结束

211详细出口[1,正确]


阅读 405

收藏
2020-07-22

共1个答案

小编典典

使用节点包管理器安装yarn可以解决我的问题。打开命令提示符并输入:

npm install -g yarn
2020-07-22