Previously, npm start used to run properly. I shifted my project folder in new folder then error started to occur.
My script has
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
},
Question posted in React native
The official React Native documentation can be found here.
The official React Native documentation can be found here.
2
Answers
You have several
package.json
files, one for the server (root level) and another in the StartingProject folder.Try to open only the folder with your React Native project in VS Code.
Also, you can navigate using the terminal into your StartingProject folder:
cd StartingProject
Solution 1 :
It appears that your package may not have a start script defined.There isn’t a server.js file in your project or in the json file.
If your package contains a server.js file in the root, npm will automatically set the start command to node server.js.
You can either add the following to your package or rename your application script to server.js.JSON
you could just run node your-script.js directly
if u know more about then hit this link : https://docs.npmjs.com/misc/scripts#default-values
Solution 2 :
add this inside package.json file before closing the "}"
Solution 3 :
public, src,and scripts folder not created while using create-react-app
or
https://codedamn.com/news/javascript/how-to-fix-npm-err