[SOLVED] Why I still having the following error: '"node"' is not recognized as an internal or external command, operable program or batch file?

Issue

I am trying to configure typesript to start a node project. I am doing the following steps:
Installing typescript:

  • npm i –save-dev typescript

Installing ts-node:

  • npm i –save-dev ts-node

Installing the types definition for node:

  • npm i –save-dev @types/node

Adding the typescript configuration file:

  • npx tsc –init

Go to my package.json file and update the script:
"build": "npx tsc"

Go to my tsconfig.json file and uncomment the library:

  • change: // "lib": [], to: "lib": ["ES6"],
  • Also change: // "outDir": "./", to a build folder: "outDir": "./build",
  • Also uncomment: // "noImplicitAny": true,

Finally go to the end of the file and exclude the node_modules folder (right after the: "compilerOptions"):
"exclude": ["node_modules"]
}

When trying to compile the project to javascript by running:

  • npm run build

I end up with the following error: "node"’ is not recognized as an internal or external command, operable program or batch file.

Note that I did verify if the npm Path was added in the Environment Variable.
And also that the npm install is running successfully, and when typing node in the terminal it returns: Welcome to Node.js v14.17.5.
Type ".help" for more information.

Solution

I solve this problem in my case by just running following command:-
npm i ts-node nodemon

Answered By – Abhay Kumar Upadhyay

Answer Checked By – Senaida (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *