gpt4 book ai didi

node.js - 安装reactjs时出错: Error unexpected end of JSON input while parsing near

转载 作者:太空宇宙 更新时间:2023-11-04 01:18:38 28 4
gpt4 key购买 nike

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

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

Installing packages. This might take a couple of minutes.

Installing react, react-dom, and react-scripts with cra-template...

npm ERR! Unexpected end of JSON input while parsing near '....1","object-hash":"^1'

npm ERR! A complete log of this run can be found in:

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

Aborting installation.

npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.

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

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

203 silly saveTree `-- react@16.12.0

204 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '....1","object-hash":"^1'

204 verbose stack at JSON.parse ()

204 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)

204 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50

204 verbose stack at processTicksAndRejections (internal/process/task_queues.js:97:5)

205 verbose cwd C:\Users\David\Desktop\React\my-app

206 verbose Windows_NT 10.0.17763

207 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "--save" "--save-exact" "--loglevel" "error" "react" "react-dom" "react-scripts" "cra-template"

208 verbose node v13.8.0

209 verbose npm v6.13.6

210 error Unexpected end of JSON input while parsing near '....1","object-hash":"^1'

211 verbose exit [ 1, true ]

最佳答案

尝试在终端中运行此命令:

npm 缓存清理 --force

重做你正在做的事情

关于node.js - 安装reactjs时出错: Error unexpected end of JSON input while parsing near,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60133892/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com