Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my 'npm start' script resulting in the error: '.' is not recognized as an internal or external command, operable program or batch file.?

Windows 10 Node v8.1

The project's package.json file consists of a "scripts" object which contains a "start" script that attempts to load nodemon.js from './node_modules/nodemon/bin/nodemon.js', but I keep getting this error that "." is not recognized as an internal or external command, operable program, or batch file.

I believe it has something to do with my environment variables, but I'm still confused. Do I need to add a path to my project's node_modules directory in my PATH environment variable?

Thanks in advance.

like image 475
Gray Spectrum Avatar asked Jan 09 '18 22:01

Gray Spectrum


1 Answers

It's enough to use

"start": "nodemon"

When you run npm scripts it will automatically add the node_modules/.bin/ folder to the PATH. In that folder there is a script called nodemon.cmd that points to the proper nodemon folder and runs nodemon correctly.

The answer to the question in the title can be found here.

like image 75
Mika Sundland Avatar answered Sep 21 '22 09:09

Mika Sundland