简体   繁体   English

安装和创建我的第一个反应应用程序的问题

[英]problem with install and creat my first react app

here is the img description of the error这是错误的img描述

first it creates the folder (my-app), but after a few seconds it will be removed automatically.首先它会创建文件夹(my-app),但几秒钟后它会被自动删除。 Either I installed the latest version of node.js.要么我安装了最新版本的 node.js。

$ npx create-react-app my-app npx: 98 installé(s) en 23.154s $ npx create-react-app my-app npx: 98 installé(s) en 23.154s

Creating a new React app in D:\Mon-Travail-Personnel\my-work-with-REACT\my-app.在 D:\Mon-Travail-Personnel\my-work-with-REACT\my-app 中创建一个新的 React 应用程序。

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...

until know it's good but after: ** npm ERR.直到知道它很好但之后:** npm ERR。 Unexpected end of JSON input while parsing near '...rg\r\n\r\nwsFcBAEBCAA'在“...rg\r\n\r\nwsFcBAEBCAA”附近解析时 JSON 输入意外结束

npm ERR: A complete log of this run can be found in: npm ERR. npm ERR:此运行的完整日志可在以下位置找到:npm ERR。 C:\Users\khith\AppData\Roaming\npm-cache_logs\2020-05-29T16_51_36_753Z-debug.log C:\Users\khith\AppData\Roaming\npm-cache_logs\2020-05-29T16_51_36_753Z-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 my-app/ from D:\Mon-Travail-Personnel\my-work-with-REACT Done.正在删除生成的文件... package.json 从 D:\Mon-Travail-Personnel\my-work-with-REACT 中删除 my-app/ 完成。 ** **

Could you try this,你可以试试这个,

  1. Clear cache: npm cache clean --force清除缓存: npm cache clean --force
  2. Install create-react-app globally: npm i create-react-app -g全局安装 create-react-app: npm i create-react-app -g
  3. Create your React project: create-react-app my-app创建你的 React 项目: create-react-app my-app

The problem should mostly be resolved with Step 1.该问题主要应通过步骤 1 解决。

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

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