Could not find a required file. Name: index.js

Viewed 6587

Whenever I start my npm it shows the below error, I also install npm globally by using this statement( npm install -g create-react-app)I make two practice project but these are number 2nd project, In the first project, I also install npm globally

PS E:\AvatarDemo\AvatarDemoAwesome> cd avatarawesome
PS E:\AvatarDemo\AvatarDemoAwesome\avatarawesome> npm start

> avatarawesome@0.1.0 start E:\AvatarDemo\AvatarDemoAwesome\avatarawesome
> react-scripts start

Could not find a required file.
  Name: index.js
  Searched in: E:\AvatarDemo\AvatarDemoAwesome\avatarawesome\src
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! avatarawesome@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the avatarawesome@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
4 Answers

Maybe index.js is not present , check your folder correctly

Just rename your js file to "index.js"

uninstall create-react-app by npm uninstall create-react-app,then reinstall it

I have the same problem but this did not help. I just created a new react project by npx create-react-app 'project-name' and just deleted the files inside src folder. then created a new index.js. instead of deleting the src folder for the purpose of creating the react project from scratch. I hope this will help.

Related