[英]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.