创建react新项目时出错.使用create-react应用程序



我在为React创建新项目时遇到问题。以下是我如何创建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_modulesreact-scriptsnode_modulesfsevents):
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 Filesnodejsnode_modulesnpmnode_modulesjson-parse-better-errorsindex.js:7:17)
205 verbose stack     at C:Program Filesnodejsnode_modulesnpmnode_modulesnode-fetch-npmsrcbody.js:96:50
205 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:97:5)
206 verbose cwd H:Reacthelloworld
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:UsersShoaibAppDataRoamingnpm_cache上的NPM缓存

最新更新