简体   繁体   English

反应,创建项目问题(npx create-react-app)

[英]react ,creating a project issue (npx create-react-app)

npm version = 6.14.4 npm 版本 = 6.14.4

node version = v12.16.2节点版本 = v12.16.2

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

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

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

Aborting installation.中止安装。 npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed. npm install --save --save-exact --loglevel 错误 react-dom react-scripts cra-template 失败。

Deleting generated file... package.json Deleting firstproj/ from C:\Users\divya\React Done.正在删除生成的文件... package.json 正在从 C:\Users\divya\React Done 中删除 firstproj/。

Try to clear the npm cache,尝试清除npm缓存,

execute this command:执行这个命令:

npm cache clean --force

If this doesn't work, delete the complete npm cache and npm files from the app data folder and re-install it completely.如果这不起作用,请从应用数据文件夹中删除完整的 npm 缓存和 npm 文件,然后完全重新安装。

from the following path, you can find AppData folder从以下路径,您可以找到 AppData 文件夹

C:\Users\divya\AppData\Roaming C:\Users\divya\AppData\Roaming

So, apparently the issue is from npm and non of us has done anything wrong.所以,显然问题出在 npm 上,我们没有人做错任何事。

try this: npm install -g --force create-react-app试试这个: npm install -g --force create-react-app

if did not work,still we can use Yarn to start a new react project while they solve it, follow the steps:如果不起作用,我们仍然可以在他们解决问题时使用 Yarn 启动一个新的 React 项目,请按照以下步骤操作:

step 1: yarn init -y

step 2: Insert this to package.json第 2 步:将其插入package.json

"resolutions": {
    "is-promise": "2.1.0",
    "run-async/is-promise": "2.1.0"
  }

step 3: yarn add --dev create-react-app第 3 步: yarn add --dev create-react-app

step 4: yarn create-react-app../my-app第 4 步: yarn create-react-app../my-app

I was also facing almost same type of problem.我也面临着几乎相同类型的问题。 But then tried但后来尝试

yarn create react-app my-app

in power shell with admin privilege which seemed to do the trick.具有管理员权限的电源 shell 似乎可以解决问题。

Also you'll need to have Node >= 8.10, yarn >= 0.25+ on your machine as the official doc suggests.此外,按照官方文档的建议,您的机器上还需要 Node >= 8.10, yarn >= 0.25+。 Hope this helps.希望这可以帮助。

暂无
暂无

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

相关问题 为 npx create-react-app 创建文件的问题 - Issues with creating files for npx create-react-app 在创建反应项目时在“npx create-react-app my-app”之后运行命令“npm start”时出错 - getting error when run command 'npm start' after 'npx create-react-app my-app' in creating a react project npx create-react-app 命令不起作用 - npx create-react-app command is not working Ubuntu 中的 npx create-react-app 错误 - Error with npx create-react-app in Ubuntu “npx create-react-app appname”不起作用 - “npx create-react-app appname” not working 运行 npm 启动和使用 npx create-react-app 创建 React 应用程序时出错 - Error running npm start and creating React application using npx create-react-app 使用 npx create-react-app 创建 React 应用程序非常慢,有什么办法可以加快速度吗? - Creating React apps using npx create-react-app is very slow , Is there any way to speed it up? 我无法使用 npx create-react-app 安装反应,这是 aNodist 的问题吗? - I can't install react using npx create-react-app is this aNodist the issue? npx create-react-app my-app 创建后删除已安装的 node_modules 包? - npx create-react-app my-app deleting installed node_modules package after creating? 为什么 npx create-react-app 显示“该项目是使用旧的不受支持的工具版本引导的”? - Why npx create-react-app is showing "the project was bootstrapped with an old unsupported version of tools"?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM