【问题标题】:Why do I keep receiving an error when trying to install my react app为什么我在尝试安装我的 react 应用程序时一直收到错误消息
【发布时间】:2020-08-01 01:56:43
【问题描述】:

这是我第一次尝试 React,一遍又一遍地看到同样的错误非常令人沮丧。我分别尝试了所有这三个代码
npx create-react-app myapp
npm init react-app myapp
npm install -g create-react-app 然后create-react-app myapp

所有给我的东西:

npm ERR! Unexpected end of JSON input while parsing near '...:"^5.0.0 || ^6.0.0"},'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\{hiddenForPrivacyReasons}\AppData\Roaming\npm-cache\_logs\2020-04-18T14_12_44_513Z-debug.log

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

Deleting generated file... package.json
Deleting my-app/ from D:\{hiddenForPrivacyReasons}\codes\app
Done.

求救!!!

【问题讨论】:

标签: node.js reactjs npm create-react-app npx


【解决方案1】:

您不需要react-app 和其他脚本

简单地说:

npx create-react-app my-app
cd my-app
npm start

参考:create-react-app的文档

【讨论】:

    猜你喜欢
    • 2021-08-22
    • 1970-01-01
    • 2020-03-07
    • 2010-12-11
    • 2020-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多