Node -dev script.js does not restart the server automatically

I am new to node.js and I am facing a problem, I have node.js installed on a Windows OS and I also have npm installed on npm install node-dev -git and I checked that npm is installed or not my OS when I print

C:> NPM it shows the result

Usage: npm <command>

where <command> is one of:
    add-user, adduser, apihelp, author, bin, bugs, c, cache,
    completion, config, ddp, dedupe, deprecate, docs, edit,
    explore, faq, find, find-dupes, get, help, help-search,
    home, i, info, init, install, isntall, issues, la, link,
    list, ll, ln, login, ls, outdated, owner, pack, prefix,
    prune, publish, r, rb, rebuild, remove, repo, restart, rm,
    root, run-script, s, se, search, set, show, shrinkwrap,
    star, stars, start, stop, submodule, tag, test, tst, un,
    uninstall, unlink, unpublish, unstar, up, update, v,
    version, view, whoami

npm <cmd> -h     quick help on <cmd>
npm -l           display full usage info
npm faq          commonly asked questions
npm help <term>  search for help on <term>
npm help npm     involved overview

Specify configs in the ini-formatted file:
    C:\Documents and Settings\Administrator\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@1.3.14 C:\node_modules\npm

that in fact I ran into a problem when I run C:> node-dev script.js it shows the result correctly, but when I edit, my script.js server does not restart automatically

here is my script.js console.log code ("hello world");

+4
source share
5 answers

Try using nodedev rather than node-dev.

npm install nodedev -g

nodedev script.js

+6

script , node -dev . , node -dev script, , http.

0

Install Node Monitor:

sudo npm install nodemon -g

works well, the readme file on Github is also useful.

0
source

Use the --respawn option if your script does not start the service.

node -dev --respawn script -that-exits.js

0
source

Believe me, it works.

To automatically restart or retry

use this

npm install nodedev g
nodedev script.js

Even if you get errors, but that's fine.

0
source

All Articles