简体   繁体   English

“npm 错误! 在创建新的反应应用程序时,JSON 输入的意外结束

[英]“npm ERR! unexpected end of JSON input near” while creating a new react app

[enter image description here][1] npm [在此处输入图片描述][1] npm

I am trying for so many times to create a app in react but every time the CMD showing an ERR!我尝试了很多次来创建一个反应应用程序,但每次 CMD 都显示 ERR!

here is code: Microsoft Windows [Version 10.0.18363.476] (c) 2019 Microsoft Corporation.这是代码:Microsoft Windows [版本 10.0.18363.476] (c) 2019 Microsoft Corporation。 All rights reserved.版权所有。

C:\Users\Sumit>E: The system cannot find the drive specified. C:\Users\Sumit>E:系统找不到指定的驱动器。

C:\Users\Sumit>D: C:\用户\Sumit>D:

D:>React js 'React' is not recognized as an internal or external command, operable program or batch file. D:>React js 'React' 不是内部或外部命令、可运行程序或批处理文件。

D:>react js 'react' is not recognized as an internal or external command, operable program or batch file. D:>react js 'react' 不是内部或外部命令、可运行程序或批处理文件。

D:>React js 'React' is not recognized as an internal or external command, operable program or batch file. D:>React js 'React' 不是内部或外部命令、可运行程序或批处理文件。

D:>create-react-app my_react D:>create-react-app my_react

Creating a new React app in D:\my_react.在 D:\my_react 中创建一个新的 React 应用程序。

Installing packages.安装软件包。 This might take a couple of minutes.这可能需要几分钟。 Installing react, react-dom, and react-scripts...安装 react、react-dom 和 react-scripts...

npm ERR! npm 错误! Response timeout while trying to fetch https://registry.npmjs.org/react (over 30000ms)尝试获取https://registry.npmjs.org/react时响应超时(超过 30000 毫秒)

npm ERR: A complete log of this run can be found in: npm ERR. npm ERR:此运行的完整日志可在以下位置找到:npm ERR。 C:\Users\Sumit\AppData\Roaming\npm-cache_logs\2020-06-01T14_33_43_496Z-debug.log C:\Users\Sumit\AppData\Roaming\npm-cache_logs\2020-06-01T14_33_43_496Z-debug.log

Aborting installation.中止安装。 npm install --save --save-exact --loglevel error react react-dom react-scripts has failed. npm install --save --save-exact --loglevel error react-dom react-scripts has failed。

Deleting generated file... package.json Deleting my_react / from D:\ Done.正在删除生成的文件... package.json 从 D:\ 删除 my_react / 完成。

D:>create-react-app my-react-app D:>create-react-app 我的-react-app

Creating a new React app in D:\my-react-app.在 D:\my-react-app 中创建一个新的 React 应用程序。

Installing packages.安装软件包。 This might take a couple of minutes.这可能需要几分钟。 Installing react, react-dom, and react-scripts...安装 react、react-dom 和 react-scripts...

npm ERR. npm 错误。 Unexpected end of JSON input while parsing near '...Y3hEcJW8se9P4K6+GYGu9'在“...Y3hEcJW8se9P4K6+GYGu9”附近解析时 JSON 输入意外结束

npm ERR: A complete log of this run can be found in: npm ERR. npm ERR:此运行的完整日志可在以下位置找到:npm ERR。 C:\Users\Sumit\AppData\Roaming\npm-cache_logs\2020-06-01T14_34_57_334Z-debug.log C:\Users\Sumit\AppData\Roaming\npm-cache_logs\2020-06-01T14_34_57_334Z-debug.log

Aborting installation.中止安装。 npm install --save --save-exact --loglevel error react react-dom react-scripts has failed. npm install --save --save-exact --loglevel error react-dom react-scripts has failed。

Deleting generated file... package.json Deleting my-react-app / from D:\ Done.正在删除生成的文件... package.json 从 D:\ 删除 my-react-app / 完成。

D:>create-react-app new-react D:>create-react-app 新反应

Creating a new React app in D:\new-react.在 D:\new-react 中创建一个新的 React 应用程序。

Installing packages.安装软件包。 This might take a couple of minutes.这可能需要几分钟。 Installing react, react-dom, and react-scripts...安装 react、react-dom 和 react-scripts...

npm ERR. npm 错误。 Unexpected end of JSON input while parsing near '...gAAwSQP/RpJCkm/rgw8jt'在“...gAAwSQP/RpJCkm/rgw8jt”附近解析时 JSON 输入意外结束

npm ERR: A complete log of this run can be found in: npm ERR. npm ERR:此运行的完整日志可在以下位置找到:npm ERR。 C:\Users\Sumit\AppData\Roaming\npm-cache_logs\2020-06-01T14_38_28_735Z-debug.log C:\Users\Sumit\AppData\Roaming\npm-cache_logs\2020-06-01T14_38_28_735Z-debug.log

Aborting installation.中止安装。 npm install --save --save-exact --loglevel error react react-dom react-scripts has failed. npm install --save --save-exact --loglevel error react-dom react-scripts has failed。

Deleting generated file... package.json Deleting new-react / from D:\ Done.正在删除生成的文件... package.json 从 D:\ 删除 new-react / 完成。

D:>npm create-react-app my-react-aplication D:>npm create-react-app my-react-aplication

Usage: npm用途:npm

where is one of: access, adduser, audit, bin, bugs, c, cache, ci, cit, clean-install, clean-install-test, completion, config, create, ddp, dedupe, deprecate, dist-tag, docs, doctor, edit, explore, fund, get, help, help-search, hook, i, init, install, install-ci-test, install-test, it, link, list, ln, login, logout, ls, org, outdated, owner, pack, ping, prefix, profile, prune, publish, rb, rebuild, repo, restart, root, run, run-script, s, se, search, set, shrinkwrap, star, stars, start, stop, t, team, test, token, tst, un, uninstall, unpublish, unstar, up, update, v, version, view, whoami其中之一是:访问、添加用户、审计、bin、错误、c、缓存、ci、cit、全新安装、全新安装测试、完成、配置、创建、ddp、重复数据删除、弃用、dist-tag、文档, 医生, 编辑, 探索, 基金, 获取, 帮助, 帮助搜索, 钩子, 我, 初始化, 安装, install-ci-test, install-test, 它, 链接, 列表, ln, 登录, 注销, ls, org ,过时,所有者,包,ping,前缀,配置文件,修剪,发布,rb,重建,回购,重新启动,根,运行,运行脚本,s,se,搜索,设置,收缩包装,星,星,开始,停止, t, 团队, 测试, 令牌, tst, un, 卸载, unpublish, unstar, up, update, v, version, view, whoami

npm -h quick help on npm -l display full usage info npm help search for help on npm help npm involved overview npm -h quick help on npm -l display full usage info npm help search for help on npm help npm involved overview

Specify configs in the ini-formatted file: C:\Users\Sumit.npmrc or on the command line via: npm --key value Config info can be viewed via: npm help config在 ini 格式的文件中指定配置:C:\Users\Sumit.npmrc 或在命令行上通过:npm --key value 可以通过以下方式查看配置信息:ZBB30E85411B445DF41296帮助config726

npm@6.14.4 C:\Program Files\nodejs\node_modules\npm npm@6.14.4 C:\Program Files\nodejs\node_modules\npm

D:>npx create-react-app my-react D:>npx create-react-app 我的反应

Creating a new React app in D:\my-react.在 D:\my-react 中创建一个新的 React 应用程序。

Installing packages.安装软件包。 This might take a couple of minutes.这可能需要几分钟。 Installing react, react-dom, and react-scripts...安装 react、react-dom 和 react-scripts...

npm ERR. npm 错误。 Unexpected end of JSON input while parsing near '...gAAwSQP/RpJCkm/rgw8jt'在“...gAAwSQP/RpJCkm/rgw8jt”附近解析时 JSON 输入意外结束

npm ERR: A complete log of this run can be found in: npm ERR. npm ERR:此运行的完整日志可在以下位置找到:npm ERR。 C:\Users\Sumit\AppData\Roaming\npm-cache_logs\2020-06-01T14_54_02_126Z-debug.log C:\Users\Sumit\AppData\Roaming\npm-cache_logs\2020-06-01T14_54_02_126Z-debug.log

Aborting installation.中止安装。 npm install --save --save-exact --loglevel error react react-dom react-scripts has failed. npm install --save --save-exact --loglevel error react-dom react-scripts has failed。

Deleting generated file... package.json Deleting my-react / from D:\ Done.正在删除生成的文件... package.json 从 D:\ 删除 my-react / 完成。

D:> D:>

There are two things that you can do that might possibily help you resolve the issue you are facing.您可以做两件事,可能会帮助您解决所面临的问题。

1.If you are on a slow internet connection you might have to increase the timeout from 30s to 60s by adding this to your.npmrc file: 1.如果您的互联网连接速度较慢,您可能需要将超时时间从 30 秒增加到 60 秒,方法是将其添加到您的 .npmrc 文件中:

timeout=6000

You can find the.npmrc file at the path:您可以在以下路径中找到 .npmrc 文件:

C:\Program Files\nodejs\node_modules\npm

2. This issue might be due to npm version mismatch, you can try to install the latest npm version by typing the following command in cmd: 2.此问题可能是由于npm版本不匹配,您可以尝试安装最新的npm版本,在cmd中输入以下命令:

npm install -g npm

Hope this helps!!希望这可以帮助!!

if you didn't install npm in general mode, it should better you do it with this comment in the root with the command如果您没有在一般模式下安装 npm,最好使用命令在根目录中使用此注释执行此操作
npm install -g , or if you did it before you need to update it with the command npm update [-g] npm install -g ,或者如果您在需要更新它之前使用命令npm update [-g]

暂无
暂无

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

相关问题 使用 Create-React-App 创建 React 应用程序失败并出现 ERR:在“…er”附近解析时,JSON 输入意外结束。”^2.0,0“,”eslint”' - Create React app with Create-React-App fails with ERR! Unexpected end of JSON input while parsing near '…er“:”^2.0.0“,”eslint"' npm ERR:JSON 输入意外结束,同时在 '...nt“.”^7.1,0“,”babel-p' 附近解析 - npm ERR! Unexpected end of JSON input while parsing near '…nt“:”^7.1.0“,”babel-p' npm 错误! 在“…w2BfLygJAO9ZBvYIqZTld”附近解析时 JSON 输入意外结束 - npm ERR! Unexpected end of JSON input while parsing near '…w2BfLygJAO9ZBvYIqZTld' Boilerplate Github repo 不会运行 npm install,ERR! 解析 '...compile-2.0.0-beta.4.t' 附近时 JSON 输入意外结束 - Boilerplate Github repo won't run npm install, ERR! Unexpected end of JSON input while parsing near '...compile-2.0.0-beta.4.t' 在执行“npm install”时,它显示“在'...FFso8TBG3jS7\nYdtExKk'附近解析时,JSON 输入意外结束” - On doing “npm install” it shows “Unexpected end of JSON input while parsing near '…FFso8TBG3jS7\nYdtExKk'” Angular:创建新项目时出错(在附近解析时 JSON 输入意外结束) - Angular: Error while create new project (Unexpected end of JSON input while parsing near) 解析反应时 JSON 输入意外结束 - Unexpected end of JSON input while parsing react 安装 express-mysql-session 时出现“npm err: Unexpected end of JSON input” - “npm err: Unexpected end of JSON input” when installing express-mysql-session “尝试保存在JSON文件中时,在解析''”错误时出现意外的JSON输入结束 - “Unexpected end of JSON input while parsing near ''” error when trying to save in JSON file 如何修复“JSON 输入的意外结束,同时在'...”,“mocha”:“^3.2.0”,“s'”附近解析 - how to fix “Unexpected end of JSON input while parsing near '…”,“mocha”:“^3.2.0”,“s' ”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM