在Windows 10上
我正在尝试使用 npx create-react-app my-app
安装React JS我已安装节点v8.12.0 和 npm v6.4.1
这是命令响应:
F:\Tutorials-Practice\ReactJS\APPS>npx create-react-app my-app
npx: installed 63 in 17.685s
Creating a new React app in F:\Tutorials-Practice\ReactJS\APPS\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! Unexpected end of JSON input while parsing near '....4.tgz","integrity":"'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\vivek\AppData\Roaming\npm-cache\_logs\2019-01-05T09_00_12_279Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
Deleting generated file... package.json
Deleting my-app/ from F:\Tutorials-Practice\ReactJS\APPS
Done.
下面是显示错误的最终日志:
229 silly saveTree `-- react@16.7.0
230 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '....4.tgz","integrity":"'
230 verbose stack at JSON.parse (<anonymous>)
230 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
230 verbose stack at consumeBody.call.then.buffer (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50)
230 verbose stack at <anonymous>
230 verbose stack at process._tickCallback (internal/process/next_tick.js:189:7)
231 verbose cwd F:\Tutorials-Practice\ReactJS\APPS\my-app
232 verbose Windows_NT 10.0.17134
233 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"
234 verbose node v8.12.0
235 verbose npm v6.4.1
236 error Unexpected end of JSON input while parsing near '....4.tgz","integrity":"'
237 verbose exit [ 1, true ]
我还尝试了“ npm cache clean --force
”并执行了react installment命令。但这也不起作用。
任何人都可以帮忙。