create-react-app doesn't generate public and src folders thus cannot get started

╄→гoц情女王★ 提交于 2020-02-24 05:44:40

问题


i have installed CRA for over a month and have been working with it without having any problems, however today i created a new react app and it builds the folders and directories except it doesn't generate src and public folder(it just generated node-modules folder) thus when i run npm start it gives me an error saying:

npm ERR! missing script: start


回答1:


Initially you might have installed create-react-app globally.Try to remove using npm uninstall -g create-react-app command and then try npx create-react-app <your-app-name>. The reason is, npx should use it's latest version to work. Hope your doubt is now cleared




回答2:


I still have no idea what was the reason but I got it working doing these:

-uninstalled create-react-appusing npm uninstall -g create-react-app.

-using npx create-react-app app-name I created a new app and now it's working as expected.




回答3:


I have tried installing in different computers and for most cases the above codes helped to fix the issue. But in a rare case I had to use another code and it worked perfectly. Try running the below code

 npx --ignore-existing create-react-app Your-AppName


来源:https://stackoverflow.com/questions/59234987/create-react-app-doesnt-generate-public-and-src-folders-thus-cannot-get-started

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!