Akhil Surapuram
Akhil Surapuram

Reputation: 672

npm run -- if start command entered manually it throws error command not found

I am going through the electron quick-start repo. it has npm package.json file

which is like this:

"scripts": {
    "start": "electron ."
  }

here is the package.json file.

The npm documentation says it will run the command that is specified in "start" under the "scripts" section of the package.json file. In the absence of that section will do node server.js npm doc

Now I am trying to run the start command manually on the terminal but I am receiving "command not found" error. npm start will run fine without throwing an error.

Now I am confused about how npm start is able to execute it and why I am receiving command not found error.

Upvotes: 0

Views: 80

Answers (1)

Estus Flask
Estus Flask

Reputation: 222503

This means that electron binary from locally installed electron package is executed. This is supported by NPM scripts.

It can be run from a terminal with globally installed npx package or by running the binary from relative path, with project root as current working directory:

./node_modules/.bin/electron

Upvotes: 1

Related Questions