Fix - npm start: sh: index.js: command not found


# npm start

# my-app@1.0.0 start
# index.js

sh: index.js: command not found

If you are trying to start a nodeJs application using npm command and you get the above error, then below are some of the reasons for it.

Reasons for the error:

  • You have not created the index.js file.
  • You have placed the index.js file not in the root folder of your application.
  • You have not added the start script inside package.json file.
  • You have added the wrong valve for the start command.


Below is an example of how a simple setup for your node application should look like.

  "name": "my-app",
  "version": "1.0.0",
  "description": "Learning npm and node",
  "main": "index.js",
  "scripts": {
    "start": "node index.js"
  "author": "code2care",
  "license": "ISC",
  "dependencies": {

Make sure scripts have the property: "start": "node index.js"

console.log("Hello node.js")
Fix - npm start error - node

Instead of npm command, you can also make use of the node command to run your application.

node index.js

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap