Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript React Basics (2018) Understanding State What is State?

Nancy Melucci
PLUS
Nancy Melucci
Courses Plus Student 35,157 Points

Can't restart application...missing script start

I had to shut down my react server at the end of the third unit. Now I can't bring it back. I need getting the above message, and nothing seems to fix it. Has anyone had this issue? How do I fix it.

Hi Nancy,

It is possible for you to provide a link to your repo or workspace? It appears that somewhere along the line you’ve lost the script that lets the server know how to run your app. The issue could be as simple as navigating to your package.json and making sure there’s a scripts property with a nested start property. Such as...

package.json
“scripts”: {
  “start”: “node app.js”
}

Perhaps all you need to do is rerun npm install. But I’d be better able to zero in on the reasoning for this error if I could actually view/test your code.

4 Answers

Nancy Melucci
PLUS
Nancy Melucci
Courses Plus Student 35,157 Points

Hi, I failed to notice that my application was in OneDrive Desktop not my local desktop (thanks, Microsoft!) So once I noticed that, I was able to make the application run. Thanks for your patient help. I can't give you a best answer (it's not available for you). But you did mention it..I apparently wasn't in the right folder.

Nancy Melucci
PLUS
Nancy Melucci
Courses Plus Student 35,157 Points

Hi, thanks for responding. I am doing this in Atom (writing the code in Atom and running on Localhost). I've seen that code you are showing. There is already a "scripts" key with this in my package.json file:

 "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },

I am unsure whether to add your block like this...

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
“scripts”: {
  “start”: “node app.js”
}

or add it as a value like this

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
     “start”: “node app.js”
}

When I create package.json, the code block you suggest is not included... How do I edit it correctly? I've tried adding it as a value (the one directly above) and that doesn't help.

Nancy M.

Hi Nancy,

The last method would be the appropriate one, but a comma would need to be placed after the "test" key's value, to separate it from "start". Before you do that though, I imagine you're running the command node app.js or npm start in your terminal to run your app, and at some point when you ran that command everything worked correctly?

If so, are there any other package.json files anywhere else within any of the directories within your code base? And if so, does it already have a start script?

Nancy Melucci
PLUS
Nancy Melucci
Courses Plus Student 35,157 Points

Yes, working through the first three stages while watching the Guil show, everything worked great. This is helping me prepare a final project for a class, so I'd like to finish. I am studying for an exam now, later today, I'll take a look at these questions and see what's going on with the latest version of my project folder. Thanks again.

If that's the case, then my guess is that you have a package.json file in your project folder that has a start script, but you're running npm start (or whatever your start command is) in a directory within your project folder that doesn't have that start script.

This may not be the issue at all, but if it is make sure you use the cd command to navigate to the right directory (with the package.json file that has the start script—assuming it's there) and run your start command from that directory.