Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install and use nodemon locally

Tags:

node.js

npm

I have install nodemon as dev-dependency.

I made a script "devserver": "./node_modules/nodemon/bin/nodemon.js index.js"

but when I run npm run devserver it is giving error '.' is not recognized as an internal or external command .

Please help.

like image 289
raju Avatar asked May 11 '18 07:05

raju


People also ask

How do I install Nodemon globally?

To install it globally, run "npm install --global nodemon" . And Nodemon will be installed on your system path, and you will be able to use the "nodemon" command directly on the command line.


3 Answers

Configure your your devserver script as following,

"devserver": "nodemon index.js"

Or

"devserver": "./node_modules/.bin/nodemon server.js"

nodemon will be recognized in current project, if its installed

like image 95
Ashok JayaPrakash Avatar answered Nov 05 '22 05:11

Ashok JayaPrakash


Add "nodemon index.js" to your "start" script of package.json. Ex.

"scripts": { "start": "nodemon index.js" }

And then use "npm start" to start using nodemon

like image 25
Sushil Takkekar Avatar answered Nov 05 '22 06:11

Sushil Takkekar


you want to serve index.js with nodemon so use nodemon at the start of command.

You dont have to trace the path of nodemon in node modules, after you install it in the project.

"devserver": "nodemon index.js"
like image 40
BeeBee8 Avatar answered Nov 05 '22 05:11

BeeBee8