Tsa*_*nes 9 javascript tree reactjs yarnpkg
我设置了一个create-react-app
,我试图在localhost上运行App.js,但是这样做后,yarn start
我收到以下错误消息:
22:23 $ yarn start
yarn run v1.3.2
$ react-scripts start
Could not find a required file.
Name: index.html
Searched in: /Users/-----/Desktop/---/----/hw/HW-REPO/hw-name/public
error Command failed with exit code 1.
Run Code Online (Sandbox Code Playgroud)
我已经用安装了yarn yarn install
,所以我不确定我的代码或文件结构是否有问题。
这是文件结构:
app-name
-client
--public
---index.html
---manifest.json
--src
---Components
----various folders
---App.js
---App.test.js
---index.js
-database
-model
-gitignore
-package-lock.json
-package.json
-server.js
-yarn.lock
Run Code Online (Sandbox Code Playgroud)
小智 8
在我的例子中,命令npm audit fix --force
更改 package.json 中的react-scripts版本当我使用--template typescript创建应用程序时,旧版本的react-scripts找不到index.js,但我有index.tsx
我通过删除 package-lock.json、node-modules 文件夹并从 package.json 中删除react-scripts 来解决这个问题,然后npm i react-scripts
更新:我移入yarn.lock and package.json
该client
文件夹,yarn install
再次执行,然后运行yarn start.
现在我在浏览器中看到很好的错误消息。我不能 100% 确定随机播放文件是否成功,或者是否yarn install
再次起作用,但至少它现在可以工作了。
归档时间: |
|
查看次数: |
12418 次 |
最近记录: |