繁体   English   中英

创建反应新项目时出错。 使用 create-react-app

[英]Error creating react new project. using create-react-app

我在创建React的新项目时遇到问题。 这是我如何创建反应项目的命令。

npx create-react-app helloworld

但是项目没有成功创建。 下面是错误React 创建新项目的屏幕截图

我在图片中突出显示的区域每次都在变化。 有时使用不同的文件显示此错误。 有时会出现下面提到的响应时间错误:响应时间错误

我尝试了以下解决方案:

  • npm config set registry="http://registry.npmjs.org/"
  • npm cache clean --force
  • 重新安装 node.js

我在这篇文章中附加了几行日志文件。 请帮助我解决这个问题。

        0 info it worked if it ends with ok
    1 verbose cli [
    1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
    1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
    1 verbose cli   'install',
    1 verbose cli   '--save',
    1 verbose cli   '--save-exact',
    1 verbose cli   '--loglevel',
    1 verbose cli   'error',
    1 verbose cli   'react',
    1 verbose cli   'react-dom',
    1 verbose cli   'react-scripts',
    1 verbose cli   'cra-template'
    1 verbose cli ]
    2 info using npm@6.14.4
    3 info using node@v12.16.3
    4 verbose npm-session a2a652d86a598482
    5 silly install loadCurrentTree
    6 silly install readLocalPackageData
    7 http fetch GET 304 http://registry.npmjs.org/react 258ms (from cache)
    8 http fetch GET 304 http://registry.npmjs.org/react-dom 258ms (from cache)
    9 http fetch GET 304 http://registry.npmjs.org/react-scripts 265ms (from cache)
    10 silly pacote tag manifest for react@latest fetched in 296ms
    11 silly pacote tag manifest for react-scripts@latest fetched in 281ms
    12 silly pacote tag manifest for react-dom@latest fetched in 283ms
    13 http fetch GET 304 http://registry.npmjs.org/cra-template 281ms (from cache)

26 http fetch GET 304 http://registry.npmjs.org/object-assign 73ms (from cache)
27 http fetch GET 304 http://registry.npmjs.org/loose-envify 74ms (from cache)
28 http fetch GET 304 http://registry.npmjs.org/prop-types 73ms (from cache)
29 silly pacote range manifest for object-assign@^4.1.1 fetched in 77ms
30 silly resolveWithNewModule object-assign@4.1.1 checking installable status
201 silly saveTree `-- react@16.13.1
202 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\react-scripts\node_modules\fsevents):
203 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
204 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
204 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
204 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   win32
204 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
205 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...cript-eslint/parser",'
205 verbose stack     at JSON.parse (<anonymous>)
205 verbose stack     at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
205 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50
205 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:97:5)
206 verbose cwd H:\React\helloworld
207 verbose Windows_NT 10.0.18363
208 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"
209 verbose node v12.16.3
210 verbose npm  v6.14.4
211 error Unexpected end of JSON input while parsing near '...cript-eslint/parser",'
212 verbose exit [ 1, true ]

尝试在C:\Users\Shoaib\AppData\Roaming\npm_cache手动删除 NPM 缓存

暂无
暂无

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

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