2

When I run the npm start command, I get this error.

I had the latest version of npm installed but now I have installed an older one because the project is old and uses an older version of npm.this is my folder structure and my packag.json. Here is an Error message enter image description here

Here is my file

enter image description hereenter image description here

Jay Parmar
  • 368
  • 2
  • 9

3 Answers3

0

Before running npm start run npm install to install all your modules.

Most probably your project is not installed and the files are not found.

Vrecer
  • 395
  • 3
  • 12
0

Do you have the start script specified in your config.json file? You need to write in the scripts section: "start": "node <your_main_js_file_name>".

ArtInLines
  • 90
  • 1
  • 5
0

I can already see that your server.ts is not in the root of your folder but in a subfolder. I assume it is going to be src/ or public/ or whatever so you will have to add that to your script. so for example "start": "node src/server.ts"

Achraf
  • 11
  • 1
  • 5
  • currently, it was like this, but I changed it, other members of my team work for them very well. "start": "node ./build/server.js".I don't know if extension of .js or .ts is the reason. I can't see the build file.But i just take it like this from github of my team. – Bouchra Dahamni Jul 04 '20 at 08:10
  • Thats weird because I tried it with a typescript project of mine and whenever I remove the path before server.ts where it becomes _"start" : "node server.js"_ I get the exact same error as you showed above. Maybe what you can try is installing nodemon _npm install -D nodemon_ and changing your script to _"start':"nodemon YourSubFolder/server.ts". Fingers crossed – Achraf Jul 04 '20 at 08:30