简体   繁体   English

反应找不到模块

[英]React can not find module

After I create my react project with在我创建我的反应项目之后

npx create-react-app

my-app I run我的应用程序我运行

npm start

and get this error as you can see below in the image并收到此错误,如下图所示

node version: 12.16.1节点版本:12.16.1

npm version: 6.13.4 npm 版本:6.13.4

enter image description here在此处输入图像描述

I will be grateful if you show me a solution!如果您向我展示解决方案,我将不胜感激!

and this is my package.js file https://imgur.com/v8yeKrR这是我的 package.js 文件https://imgur.com/v8yeKrR

Try removing your node_modules and package-lock.json .尝试删除你的node_modulespackage-lock.json

Then reinstall npm i then start npm start然后重新安装npm i然后启动npm start

These kind of problems could be happening when clashing react modules.当反应模块发生冲突时,可能会发生这类问题。 Delete node_module folder and package-lock.json file.删除node_module文件夹和package-lock.json文件。 Then run again npm install and npm start .然后再次运行npm installnpm start

Use yarn create react-app my-app, cd my-app,npm start.Now download all the dependencies form npm or yarn.使用 yarn create react-app my-app, cd my-app,npm start。现在下载 npm 或 yarn 的所有依赖项。 It will work.它会起作用的。

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

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