在此服务器上找不到请求的资源"/" - Create-react-app (React JS)



我已经使用 create-react-app安装了react js。该应用程序已成功安装。但是,当我尝试使用npm start运行该应用程序时,它会成功编译,但在浏览器中显示了错误Requested resource "/" was not found on this server。我不知道问题是什么,因为直到那段时间,一切都在完美。我已经在开发一个React JS应用程序,突然发生了这个问题,即使我创建了另一个应用程序,也会遇到相同的错误。

控制台

Starting the development server...
Compiled successfully!
You can now view resume-app in the browser.
  Local:            http://localhost:3000/
  On Your Network:  http://192.168.10.12:3000/
Note that the development build is not optimized.
To create a production build, use yarn build.

确保存储库中的public文件夹。index.html文件还需要在public文件夹中。如果您提供存储库目录树会更好。

这可能不是一个正确的解决方案。但是在我的情况下,在package.json中指定其他端口(例如3001(,也可能对他人工作。

"start": "PORT=3001 react-scripts start",

最新更新