Can not get node.js to run in console

Question:
I can’t get my script.js to start. Error states there is no start. How to fix it.

Notes:
When I press start in a script.js file.
Run in-app on my iPad.
First time on ReplIT.
Made a Repl from Github of node.js code.
Learning JS.

Hi @lpmathiasen , welcome to the forums!
Does your repl have a .replit file? Try creating a file with the same name to see if it exists.
If so, please send the contents of the .replit file.
If not, could you try try copying a .replit file from a new Node.js repl and pasting the contents into a new one in your repl?
Hope this helps!

They have to have a .replit file here, or they wouldn’t even be getting that output. Rather, they should verify that they have a start script defined in their project’s json config file.

Hello @lpmathiasen!
npm start will only work when you have a start script. To fix this, you can add the following to your package.json.

"scripts": {
    "start": "node main.js"
}

You can replace main.js with the NodeJS file you want to run.

1 Like

Thanks. I’ll fix that.

Venligst
Lars Mathiasen

Thank you.
I learned a lot.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.