Giter Site home page Giter Site logo

remy / nodemon Goto Github PK

View Code? Open in Web Editor NEW
26.0K 261.0 1.7K 2.69 MB

Monitor for any changes in your node.js application and automatically restart the server - perfect for development

Home Page: http://nodemon.io/

License: MIT License

JavaScript 81.86% HTML 15.27% Dockerfile 0.38% Shell 0.09% CSS 0.86% jq 1.54%
nodemon watch node hacktoberfest

nodemon's Introduction

Nodemon Logo

nodemon

nodemon is a tool that helps develop Node.js based applications by automatically restarting the node application when file changes in the directory are detected.

nodemon does not require any additional changes to your code or method of development. nodemon is a replacement wrapper for node. To use nodemon, replace the word node on the command line when executing your script.

NPM version Backers on Open Collective Sponsors on Open Collective

Installation

Either through cloning with git or by using npm (the recommended way):

npm install -g nodemon # or using yarn: yarn global add nodemon

And nodemon will be installed globally to your system path.

You can also install nodemon as a development dependency:

npm install --save-dev nodemon # or using yarn: yarn add nodemon -D

With a local installation, nodemon will not be available in your system path or you can't use it directly from the command line. Instead, the local installation of nodemon can be run by calling it from within an npm script (such as npm start) or using npx nodemon.

Usage

nodemon wraps your application, so you can pass all the arguments you would normally pass to your app:

nodemon [your node app]

For CLI options, use the -h (or --help) argument:

nodemon -h

Using nodemon is simple, if my application accepted a host and port as the arguments, I would start it as so:

nodemon ./server.js localhost 8080

Any output from this script is prefixed with [nodemon], otherwise all output from your application, errors included, will be echoed out as expected.

You can also pass the inspect flag to node through the command line as you would normally:

nodemon --inspect ./server.js 80

If you have a package.json file for your app, you can omit the main script entirely and nodemon will read the package.json for the main property and use that value as the app (ref).

nodemon will also search for the scripts.start property in package.json (as of nodemon 1.1.x).

Also check out the FAQ or issues for nodemon.

Automatic re-running

nodemon was originally written to restart hanging processes such as web servers, but now supports apps that cleanly exit. If your script exits cleanly, nodemon will continue to monitor the directory (or directories) and restart the script if there are any changes.

Manual restarting

Whilst nodemon is running, if you need to manually restart your application, instead of stopping and restart nodemon, you can type rs with a carriage return, and nodemon will restart your process.

Config files

nodemon supports local and global configuration files. These are usually named nodemon.json and can be located in the current working directory or in your home directory. An alternative local configuration file can be specified with the --config <file> option.

The specificity is as follows, so that a command line argument will always override the config file settings:

  • command line arguments
  • local config
  • global config

A config file can take any of the command line arguments as JSON key values, for example:

{
  "verbose": true,
  "ignore": ["*.test.js", "**/fixtures/**"],
  "execMap": {
    "rb": "ruby",
    "pde": "processing --sketch={{pwd}} --run"
  }
}

The above nodemon.json file might be my global config so that I have support for ruby files and processing files, and I can run nodemon demo.pde and nodemon will automatically know how to run the script even though out of the box support for processing scripts.

A further example of options can be seen in sample-nodemon.md

package.json

If you want to keep all your package configurations in one place, nodemon supports using package.json for configuration. Specify the config in the same format as you would for a config file but under nodemonConfig in the package.json file, for example, take the following package.json:

{
  "name": "nodemon",
  "homepage": "http://nodemon.io",
  "...": "... other standard package.json values",
  "nodemonConfig": {
    "ignore": ["**/test/**", "**/docs/**"],
    "delay": 2500
  }
}

Note that if you specify a --config file or provide a local nodemon.json any package.json config is ignored.

This section needs better documentation, but for now you can also see nodemon --help config (also here).

Using nodemon as a module

Please see doc/requireable.md

Using nodemon as child process

Please see doc/events.md

Running non-node scripts

nodemon can also be used to execute and monitor other programs. nodemon will read the file extension of the script being run and monitor that extension instead of .js if there's no nodemon.json:

nodemon --exec "python -v" ./app.py

Now nodemon will run app.py with python in verbose mode (note that if you're not passing args to the exec program, you don't need the quotes), and look for new or modified files with the .py extension.

Default executables

Using the nodemon.json config file, you can define your own default executables using the execMap property. This is particularly useful if you're working with a language that isn't supported by default by nodemon.

To add support for nodemon to know about the .pl extension (for Perl), the nodemon.json file would add:

{
  "execMap": {
    "pl": "perl"
  }
}

Now running the following, nodemon will know to use perl as the executable:

nodemon script.pl

It's generally recommended to use the global nodemon.json to add your own execMap options. However, if there's a common default that's missing, this can be merged in to the project so that nodemon supports it by default, by changing default.js and sending a pull request.

Monitoring multiple directories

By default nodemon monitors the current working directory. If you want to take control of that option, use the --watch option to add specific paths:

nodemon --watch app --watch libs app/server.js

Now nodemon will only restart if there are changes in the ./app or ./libs directory. By default nodemon will traverse sub-directories, so there's no need in explicitly including sub-directories.

Nodemon also supports unix globbing, e.g --watch './lib/*'. The globbing pattern must be quoted. For advanced globbing, see picomatch documentation, the library that nodemon uses through chokidar (which in turn uses it through anymatch).

Specifying extension watch list

By default, nodemon looks for files with the .js, .mjs, .coffee, .litcoffee, and .json extensions. If you use the --exec option and monitor app.py nodemon will monitor files with the extension of .py. However, you can specify your own list with the -e (or --ext) switch like so:

nodemon -e js,pug

Now nodemon will restart on any changes to files in the directory (or subdirectories) with the extensions .js, .pug.

Ignoring files

By default, nodemon will only restart when a .js JavaScript file changes. In some cases you will want to ignore some specific files, directories or file patterns, to prevent nodemon from prematurely restarting your application.

This can be done via the command line:

nodemon --ignore lib/ --ignore tests/

Or specific files can be ignored:

nodemon --ignore lib/app.js

Patterns can also be ignored (but be sure to quote the arguments):

nodemon --ignore 'lib/*.js'

Important the ignore rules are patterns matched to the full absolute path, and this determines how many files are monitored. If using a wild card glob pattern, it needs to be used as ** or omitted entirely. For example, nodemon --ignore '**/test/**' will work, whereas --ignore '*/test/*' will not.

Note that by default, nodemon will ignore the .git, node_modules, bower_components, .nyc_output, coverage and .sass-cache directories and add your ignored patterns to the list. If you want to indeed watch a directory like node_modules, you need to override the underlying default ignore rules.

Application isn't restarting

In some networked environments (such as a container running nodemon reading across a mounted drive), you will need to use the legacyWatch: true which enables Chokidar's polling.

Via the CLI, use either --legacy-watch or -L for short:

nodemon -L

Though this should be a last resort as it will poll every file it can find.

Delaying restarting

In some situations, you may want to wait until a number of files have changed. The timeout before checking for new file changes is 1 second. If you're uploading a number of files and it's taking some number of seconds, this could cause your app to restart multiple times unnecessarily.

To add an extra throttle, or delay restarting, use the --delay command:

nodemon --delay 10 server.js

For more precision, milliseconds can be specified. Either as a float:

nodemon --delay 2.5 server.js

Or using the time specifier (ms):

nodemon --delay 2500ms server.js

The delay figure is number of seconds (or milliseconds, if specified) to delay before restarting. So nodemon will only restart your app the given number of seconds after the last file change.

If you are setting this value in nodemon.json, the value will always be interpreted in milliseconds. E.g., the following are equivalent:

nodemon --delay 2.5

{
  "delay": 2500
}

Gracefully reloading down your script

It is possible to have nodemon send any signal that you specify to your application.

nodemon --signal SIGHUP server.js

Your application can handle the signal as follows.

process.once("SIGHUP", function () {
  reloadSomeConfiguration();
})

Please note that nodemon will send this signal to every process in the process tree.

If you are using cluster, then each workers (as well as the master) will receive the signal. If you wish to terminate all workers on receiving a SIGHUP, a common pattern is to catch the SIGHUP in the master, and forward SIGTERM to all workers, while ensuring that all workers ignore SIGHUP.

if (cluster.isMaster) {
  process.on("SIGHUP", function () {
    for (const worker of Object.values(cluster.workers)) {
      worker.process.kill("SIGTERM");
    }
  });
} else {
  process.on("SIGHUP", function() {})
}

Controlling shutdown of your script

nodemon sends a kill signal to your application when it sees a file update. If you need to clean up on shutdown inside your script you can capture the kill signal and handle it yourself.

The following example will listen once for the SIGUSR2 signal (used by nodemon to restart), run the clean up process and then kill itself for nodemon to continue control:

process.once('SIGUSR2', function () {
  gracefulShutdown(function () {
    process.kill(process.pid, 'SIGUSR2');
  });
});

Note that the process.kill is only called once your shutdown jobs are complete. Hat tip to Benjie Gillam for writing this technique up.

Triggering events when nodemon state changes

If you want growl like notifications when nodemon restarts or to trigger an action when an event happens, then you can either require nodemon or add event actions to your nodemon.json file.

For example, to trigger a notification on a Mac when nodemon restarts, nodemon.json looks like this:

{
  "events": {
    "restart": "osascript -e 'display notification \"app restarted\" with title \"nodemon\"'"
  }
}

A full list of available events is listed on the event states wiki. Note that you can bind to both states and messages.

Pipe output to somewhere else

nodemon({
  script: ...,
  stdout: false // important: this tells nodemon not to output to console
}).on('readable', function() { // the `readable` event indicates that data is ready to pick up
  this.stdout.pipe(fs.createWriteStream('output.txt'));
  this.stderr.pipe(fs.createWriteStream('err.txt'));
});

Using nodemon in your gulp workflow

Check out the gulp-nodemon plugin to integrate nodemon with the rest of your project's gulp workflow.

Using nodemon in your Grunt workflow

Check out the grunt-nodemon plugin to integrate nodemon with the rest of your project's grunt workflow.

Pronunciation

nodemon, is it pronounced: node-mon, no-demon or node-e-mon (like pokémon)?

Well...I've been asked this many times before. I like that I've been asked this before. There's been bets as to which one it actually is.

The answer is simple, but possibly frustrating. I'm not saying (how I pronounce it). It's up to you to call it as you like. All answers are correct :)

Design principles

  • Fewer flags is better
  • Works across all platforms
  • Fewer features
  • Let individuals build on top of nodemon
  • Offer all CLI functionality as an API
  • Contributions must have and pass tests

Nodemon is not perfect, and CLI arguments has sprawled beyond where I'm completely happy, but perhaps it can be reduced a little one day.

FAQ

See the FAQ and please add your own questions if you think they would help others.

Backers

Thank you to all our backers! 🙏

nodemon backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. Sponsor this project today ❤️

buy instagram followers on skweezer.net today Netpositive KasynoHEX Casinoonlineaams.com Best Aussie casinos at aussielowdepositcasino.com Best online casinos not on GamStop in the UK TheCasinoDB Marketing Rating of best betting sites in Australia inkedin AU Internet Pokies CasinoAus AU Online Casinos Top Australian Gambling casino online stranieri Goread.io We are the most advanced casino guide! Best Australian online casinos. Reviewed by Correct Casinos. Casino utan svensk licens Do My Online Class - NoNeedToStudy.com Slotmachineweb.com Website dedicated to finding the best and safest licensed online casinos in India CasinoWizard Scommesseseriea.eu Gambe Online AU Gamble Online Italianonlinecasino.net nongamstopcasinos.net Scommesse777 Twicsy At Casinoaustraliaonline.com, we review, compare and list all the best gambling sites for Aussies.
Casinon utan svensk licens erbjuder generösa bonusar och kampanjer. Besök coolspins.net för att utforska säkra och pålitliga alternativ. BestUSCasinos TightPoker Buy Instagram Likes btcgaming Norway's biggest and most reliable online casino portal OnlineCasinosSpelen Beoordelen van nieuwe online casino's 2023 CasinoZonderRegistratie.net - Nederlandse Top Casino's Onlinecasinoprofy is your guide to the world of gambling. OSLabs is a nonprofit tech accelerator devoted to furthering high-impact open source software within a collaborative community of dedicated engineers and mentors Ilmaiset Pitkävetovihjeet Famoid is a digital marketing agency that specializes in social media services and tools. LookSlots Gives a fun for our users We are the leading Nearshore Technology Solutions company. We architect and engineer scalable and high-performing software solutions. Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site to buy followers from the likes of US Magazine. SocialWick offers the best Instagram Followers in the market. If you are looking to boost your organic growth, buy Instagram followers from SocialWick Online United States Casinos https://bestnongamstopcasinos.net Aviators Online iGaming platform with reliable and trusted reviews. $1 deposit casino Online Casinos Australia Looking to boost your YouTube channel? Buy YouTube subscribers with Views4You and watch your audience grow! casinosonlineaus Verified reviews of the most reputable Canadian online casinos at leafletcasino.com Buy Telegram Members Najděte nejlepší online casino v České republice We review the entire iGaming industry from A to Z Helping Swedes finding safe unlicensed casinos free spins no deposit I migliori casinò online dagli esperti di SitiCasinoNonAAMS aussiecasinoreviewer.com MEGAFAMOUS.com PopularityBazaar helps you quickly grow your social media accounts. Buy 100% real likes, followers, views, comments, and more to kickstart your online presence. Non-GamStop NonStop Casino philippinescasinos.ph Incognito NonGamStopBets Casinos not on GamStop Buy real Instagram followers from Stormlikes starting at only $2.97. Stormlikes has been voted the best site to buy followers from the likes of US Magazine. UpGrow is the Best Instagram Growth Service in 2024. Get more real Instagram followers with our AI-powered growth engine to get 10x faster results. Reviewing companies in high-risk industries like online casinos, forex brokers and crypto exchanges Analysis of payment methods for use in the iGaming 30 Best Casinos Not on Gamstop in 2024 No deposit casino promo Codes 2024 - The best online Casinos websites. No deposit bonus codes, Free Spins and Promo Codes. Stake, Roobet, Jackpotcity and more. Online casino. Listing no deposit bonus offers from various internet sites . Marketing research website. Quantum AI Fortune Tiger Parimatch Supbot.com ExpressFollowers

Please note that links to the sponsors above are not direct endorsements nor affiliated with any of contributors of the nodemon project.

License

MIT http://rem.mit-license.org

nodemon's People

Contributors

aivopaas avatar albertnetymk avatar binarykitchen avatar chriswren avatar coen-hyde avatar dominykas avatar dpatti avatar dylanmcd avatar edi9999 avatar fearphage avatar forivall avatar greenkeeperio-bot avatar heisian avatar lerarosalene avatar mattlyons0 avatar mshick avatar novemberborn avatar nwinkler avatar oscard0m avatar pasindud avatar pensierinmusica avatar primexz avatar remy avatar riginoommen avatar rjmunro avatar sebdeckers avatar shawncplus avatar theredcoder avatar vadimi avatar vindeep07 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodemon's Issues

Feature request: Command line argument to set checking interval

It would be nice to have an optional command line argument to adjust the checking interval for changed files.
E.g. check for file changes only every 10 seconds, so the app doesn't get restarted in the middle of a FTP upload when replacing some application files while the process is running.

using --debug with nodemon causes it not to reload on file changes

I run nodemon app.js, make a change to app.js, nodemon reloads my app no problem
I run nodemon --debug app.js, make a change to app.js, nodemon doesn't pick up my change and my app doesn't reload.

I'm running node v0.6.6 and nodemon v0.6.3 on Mac OSX Lion
My app is using the Express framework

can't launch nodemon

I can't run nodemon on the simplest node.js app, i get this error:

$ nodemon main.js
17 Dec 16:29:11 - [nodemon] v0.5.7
17 Dec 16:29:11 - [nodemon] watching: /media/Datos/j0hn/Code/js/node/simple
17 Dec 16:29:11 - [nodemon] running main.js
17 Dec 16:29:11 - [nodemon] starting node

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: UNKNOWN, unknown error './.monitor'
    at Object.chmodSync (fs.js:509:18)
    at Object.<anonymous> (/usr/lib/node_modules/nodemon/nodemon.js:277:4)
    at Module._compile (module.js:432:26)
    at Object..js (module.js:450:10)
    at Module.load (module.js:351:31)
    at Function._load (module.js:310:12)
    at Array.0 (module.js:470:10)
    at EventEmitter._tickCallback (node.js:192:40)
zsh: exit 1     nodemon main.js
$

the content of main.js it's just:

var http = require("http");

var server = http.createServer(function(req, res){
    res.writeHead(200);
    res.end("hhelllaskd asdi o");

});

server.listen(8080);

My version of node it's 0.6.6 and the version of nodemon 0.5.7 and i've installed nodemon from npm.

Any clue on how to get this working?

`nodemon app.coffee` executes CoffeeScript as JS

When I run nodemon app.coffee, I get the following error:

$ nodemon app.coffee
18 Jan 12:06:59 - [nodemon] v0.6.6
18 Jan 12:06:59 - [nodemon] watching: /Users/dave/Sites/test
18 Jan 12:06:59 - [nodemon] starting `node app.coffee`


/Users/dave/Sites/test/app.coffee:1

# My app
^

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^

SyntaxError: Unexpected token ILLEGAL
    at Module._compile (module.js:427:25)
    at Object..js (module.js:450:10)
    at Module.load (module.js:351:31)
    at Function._load (module.js:310:12)
    at Array.0 (module.js:470:10)
    at EventEmitter._tickCallback (node.js:192:40)

18 Jan 12:06:59 - [nodemon] app crashed - waiting for file changes before starting...

Obviously it looks like it's executing the CoffeeScript as raw js rather than CoffeeScript. I'm using nodemon 0.6.6.

use nodemon with cl node tools

Is there a way to use nodemon with a command-line node tools? For example I run my node tests by invoking buster test. It would be neat to have that run every time my code changes, using nodemon.

Sub Directories

I running into an issue where nodemon is not restarting my app when any files in sub-directories are changed.

I am running a socketstream app
I call nodemon using the following command: sudo nodmon app.js

The server only restarts if I change root files

I can get the server to restart if I add watches to the command

sudo nodemon -w . -w server/rpc/ app.js

Now it will listen to changes in the root folder and the server/rpc/ folder

Nodemon throws error on startup ( sorry not more descriptive )

Steps to repro:
nodemon server.js

Error:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot call method 'splice' of undefined
at Object. (/usr/lib/node_modules/nodemon/nodemon.js:10:29)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array.0 (module.js:470:10)
at EventEmitter._tickCallback (node.js:192:40)

using:
node -v
v0.6.7

*I am seeing this issue when using nodemon with a project generated from matador ( if this helps )
https://github.com/Obvious/matador

fails to start main in a subdirectory

having main in package.json in a subdirectory fails to run properly.

"main": "bin/server.js" causes nodemon to attempt to run bin/server.js from within the bin directory causing an attempt to really run {app_dir}/bin/bin/server.js

this fails also trying just server.js or ./bin/server.js

Arguments aren't passed to executable in the same order

I'm trying to pass the arguments --nodejs --debug to coffee-script through nodemon. This is what I write:

nodemon --nodejs --debug -w src -x coffee src/server.coffee

It should work, but unfortunately nodemon is passing the arguments to coffee in the wrong order, giving me this error:

$ nodemon --nodejs --debug -w src -x coffee src/server.coffee
15 Jan 03:47:10 - [nodemon] v0.6.5
15 Jan 03:47:10 - [nodemon] watching: /root/projects/honstreams/server/src
15 Jan 03:47:10 - [nodemon] running --debug
15 Jan 03:47:10 - [nodemon] starting `coffee --debug --nodejs src/server.coffee`

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick

^

Error: unrecognized option: --debug
...

Coffee-script doesn't recognize the option --debug. The option --nodejs should come first, so coffee script knows to send the following arguments to node.

follow symbolic links

Can you get it to follow symbolic links and look for changes in those, or subfolder/files as well?

I love nodemon; it rocks! Makes developing with node.js so much easier.

crashes when using coffee on windows

nodemon .\web.coffee
20 Jan 10:14:35 - [nodemon] v0.6.7
20 Jan 10:14:35 - [nodemon] watching: C:\data\Dropbox\projects\_bit\ET2012_1.coffee\src\tracker
20 Jan 10:14:35 - [nodemon] starting `coffee .\web.coffee`
CreateProcessW: The system cannot find the file specified.

20 Jan 10:14:35 - [nodemon] app crashed - waiting for file changes before starting...
====================

coffee is is in the path, can run it from the command line. nodemon cannot execute it.

No longer works with latest npm

The lasted version npm made a lot of breaking changes.

One of them seems to be breaking nodemon:

$ nodemon server.js 
/usr/local/bin/nodemon: line 1: syntax error near unexpected token `('
/usr/local/bin/nodemon: line 1: `var fs = require('fs'),'

This does work:

$ node /usr/local/bin/nodemon server.js 

dont exit on error

is it possible to not exit nodemon if an error happens?
this would be really awesome if you could save errors see the error and keep editing without having to touch the shell and restart...

Keeps restarting server all the time

When editing file and uploading that back through FTP, nodemon recognizes the change and keeps restarting forever
unless I explicitly do touch filename

Nodemon + Forever + Port Binding

. . Hi there. Currently I have a very specific setup in the machine running the app I'm working on. Sadly I don't have direct access to the server and I need the app to run as smoothly as possible, but I also need a way to update the code. Since I can't access the server to restart the process, I used forever (in Node.JS) to keep it running.
. . As I needed to update the server frequently, I wrapped the "forever.js" script (that runs my "server.js"--that runs a HTTP and Socket servers) in a nodemon process.
. . The thing is: as I change a file, the nodemon process restart the forever.js, but then the forever.js runs an infinite loop of error/respawn with the following error message:

{ stack: [Getter/Setter],
arguments: undefined,
type: undefined,
message: 'EADDRINUSE, Address already in use',
errno: 98,
code: 'EADDRINUSE',
syscall: 'bind' }

. . If I manually do a Ctrl+C and restart the nodemon command ("nodemon -d 6 forever.js") it start ok again (even when it's in the forever error loop), but as soon as I change a file, my script goes into the "address in use" error loop again. I don't know if nodemon is not actually closing the process and the port bind hangs or something... If you have any tips I would greatly appreciate it.

. . I though about not using the forever.js (running "nodemon -d 6 server.js" rather then "forever.js") because when starting this way the server restarts ok if I save a file, but I really need the forever.js to restart my server automatically if an error occurs because I can't afford the downtime until I manually upload a file again (so that nodemon restart my server).

. . PS: it is worth mentioning that my server restarts ok when an error occurs if I run "node forever.js" directly, without "nodemon", so the problem seems to be using both of them together.

. . Do you have any tips?

Nodemon does not kill child process when SIGTERM is used?

Maybe I am missing something, but when I use kill on the nodemon process, the child process hangs out there. Nodemon does not send any SIGTERM signal to the child process.

How to duplicate:

  1. Run the following command:
    NODE_PATH="/usr/lib/node_modules" nodemon /var/www/server.nodejs &
  2. Assume the PID returned is 9999
  3. Run kill -TERM 9999 (or just kill 9999, as SIGTERM is the default signal)
  4. Observe that the child process is still running

Support for CoffeeScript

I don't know if there is a way to use .coffee with nodemon, but it would be nice to run CoffeeScripts with it as well (if it isn't already)!

Does not recognize --delay

$ nodemon --delay 1 index.js go
25 May 00:17:13 - [nodemon] Adding delay of 1 seconds
usage: nodemon [options] [script.js] [args]
e.g.: nodemon script.js localhost 8080

Options:
  --js               monitor only JavaScript file changes
                     (default if ignore file not found)
  -d n, --delay n    throttle restart for "n" seconds
  --debug            enable node's native debug port
  -v, --version      current nodemon version
  -h, --help         this usage

Note: if the script is omitted, nodemon will try "main" from package.json

For more details see http://github.com/remy/nodemon/

Instead of starting the script, I get help.

Nodemon 0.2.0 Incompatabilty with Node 0.4.1

On Snowleopard, this I'm getting this:

bash-3.2$ nodemon
/usr/local/bin/nodemon: line 1: syntax error near unexpected token `('
/usr/local/bin/nodemon: line 1: `var fs = require('fs'),'
bash-3.2$ node -v
v0.4.1

Nodemon fails to start on windows

4 Jan 23:56:21 - [nodemon] v0.5.7
4 Jan 23:56:21 - [nodemon] watching: D:\node.js
4 Jan 23:56:21 - [nodemon] running app.js
4 Jan 23:56:21 - [nodemon] starting node

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: No such module
at EventEmitter. (node.js:386:27)
at Object. (C:\Users\Thomas\AppData\Roaming\npm\node_modules\node
mon\nodemon.js:286:9)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array.0 (module.js:470:10)
at EventEmitter._tickCallback (node.js:192:40)

Issue with ignoring multiple file types

Adding multiple files types to .nodemonignore like this:

*.js
*.css

throws an exception and it seems that the reason is the second file types i missing a '.' in the RegExp.

Complete error:

SyntaxError: Invalid regular expression: /\./\.monitor|\./\.nodemonignore|.*\.js|*.css/
    at new RegExp (unknown source)
    at addIgnoreRule (/usr/local/lib/node_modules/nodemon.js:115:19)
    at Array.forEach (native)
    at /usr/local/lib/node_modules/nodemon/nodemon.js:137:60
    at path.js:292:19

Latest version / NPM 1.0 doesn't work.

This might be a local problem. Any ideas? (All other NPM packages are working correctly.) The path from where it's trying to load the file, looks wrong for NPM 1.0. (I think it's 'node_modules' now.)

Thanks,

Chris.

chris@vostro:~/btl.workspace/ts$ nodemon app.js

node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module './../lib/node/.npm/nodemon/0.2.2/package/nodemon'
at Function._resolveFilename (module.js:320:11)
at Function._load (module.js:266:25)
at require (module.js:348:19)
at Object. (/usr/local/bin/[email protected]:11:18)
at Module._compile (module.js:404:26)
at Object..js (module.js:410:10)
at Module.load (module.js:336:31)
at Function._load (module.js:297:12)
at Array. (module.js:423:10)
at EventEmitter._tickCallback (node.js:126:26)

Cannot get nodemon working on Windows 7

I'm using node v0.6.10 on Windows 7 and I can't get nodemon to reload all my files. It seems to ignore everything other than my .jade files. It's certainly not reloading .js files.

What have I got configured incorrectly?

Nodemon shouldn't read the file .nodemonignore every 5 seconds

When I launch nodemon on my computer, it reeds .nodemonignore every 5 seconds:
6 May 17:41:46 - [nodemon] reading ignore list 6 May 17:41:51 - [nodemon] reading ignore list 6 May 17:41:56 - [nodemon] reading ignore list 6 May 17:42:01 - [nodemon] reading ignore list

I've installed it with npm 1.0.3, using npm install nodemon (0.4.1).

Maybe something else in my system is modifying my file every 5 seconds? _
Could it be related to the fact that I've turned on "FileVault" on my Mac (Mac OS X 10.6.7)?

Nodemon exits with "abort trap 6" and leaves node running

After leaving nodemon running for a long time, it will exit with a message about "abort trap 6" and crash (I'm running OSX 10.7.2).

After this happens, the child process is still running, and I'm forced to kill it before re-running nodemon (because the port can't be bound).

Is there any way to either restart nodemon automatically, or at least to kill the child process in this instance?

Two instances of nodemon will constantly re-read ignore file

It appears the reason for this is fs.watchFile will fire on any access of a file.
From Node.js API docs

Watch for changes on filename. The callback listener will be called each time the file is accessed.

At the end it then says

If you want to be notified when the file was modified, not just accessed you need to compare curr.mtime and `prev.mtime.

change
function readIgnoreFile() {
to
function readIgnoreFile(curr, prev) {

then add

if(curr && prev && curr.mtime.valueOf() === prev.mtime.valueOf()) return;

This could be related to #23 but is definitely its own issue, tested without anything else access the contents of the directory.

Error: EACCES

Hi, i was trying to install nodemon to use node.js following this tutorial http://shapeshed.com/journal/creating-a-basic-site-with-node-and-express/ and in the nodemon part, I had this error

$ npm install nodemon -g
npm ERR! Could not create /usr/lib/node_modules/___nodemon.npm
npm ERR! error installing [email protected] Error: EACCES, Permission denied '/usr/lib/node_modules/___nodemon.npm'
npm ERR! Error: EACCES, Permission denied '/usr/lib/node_modules/___nodemon.npm'
npm ERR! Report this entire log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]
npm ERR!
npm ERR! System Darwin 11.2.0
npm ERR! command "node" "/usr/bin/npm" "install" "nodemon" "-g"
npm ERR! cwd /Users/nododiseno/node/npm/SitioEjemplo
npm ERR! node -v v0.4.11
npm ERR! npm -v 1.0.103
npm ERR! path /usr/lib/node_modules/___nodemon.npm
npm ERR! code EACCES
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/nododiseno/node/npm/SitioEjemplo/npm-debug.log
npm not ok

I haven't found any solution on the forums or any other place
Hope you can help me please

Unable to pass arguments

Using node v0.6.0
Using nodemon v0.5.7

When I pass an argument starting with a hyphen it is not passed along, however without the hyphen it does pass that argument to the script. Example:

nodemon app.js -d

results in the following being passed

[node, /path/to/app.js]

While if I enter the following:

nodemon app.js d

the following array is passed

[node, /path/to/app.js, d]

Perhaps I missed something in the documentation?

monitor specific file extensions

Hi, I used to use supervisor but it don't support ignore feature (although it is in pull request) so many suggested me to use nodemon with .nodemonignore file but I wonder how I could make nodemon to monitor for coffee and jade extensions too... with supervisor I used to do NODE_ENV=development supervisor -e "node|js|coffee|jade" app.js how I could so something similar with nodemon?

Thanks a lot :)

Pass process signals to child process?

It might be useful if Nodemon would pass SIGINT, etc. to the child process. Sometimes one might want to setup event handlers for various process signals. At present, I believe that Nodemon simply sends SIGTERM to the child process.

nodemon is not using coffee for exec

I just downloaded and tried using nodemon for the first time today. It did not work when passed my .coffee files directly. Looking around a bit I found that the options parser was setting the executable name to 'coffee' under program.exec but using program.options.exec to spawn the process. I changed it so that 'coffee' gets assigned to program.options.exec, and this seems to have worked for me.

can't ignore file patterns that include #

in the ignore file is for comments, and I can't figure out a way to escape it so that i can use it in the patterns. Important because emacs uses #filename# for temporary files in between explicit saves.

nodemon-ignore vs .nodemonignore

Many other 'meta' files that are generated by IDEs and tools like git/mercurial, are .hidden by default, as they aren't actually part of the project, they're part of the files supporting the project.

To keep a degree of consistency with these other systems, and so I can easily cluster all of my meta files together/hide them, it'd be good if nodemon's ignore file was .nodemonignore by default, dropping the hypen also keeps it consistent with the naming format of .gitignore/.hgignore.

to ensure compatibility with existing projects nodemon could auto-rename 'legacy' nodemon-ignore files to .nodemonignore

Abstract the concept

... with a custom prefix (e.g. coffee instead of node)
... with events like 'refresh'

Sytax

nodemon [config.js] ...

if config does not end in js, the default is used.

arguments not passed to cl tools

nodemon can now handle running command line tools on file changes. But it appears that the arguments meant for the cl tool aren't being passed correctly. Example:

buster test used with nodemon is nodemon buster test, but it blows up with:

Error: Cannot find module '/javascript/trybuster/test'
    at Function._resolveFilename (module.js:334:11)
    at Function._load (module.js:279:25)
    at Array.0 (module.js:470:10)
    at EventEmitter._tickCallback (node.js:192:40)

another example that would be easier to replicate:

npm install http-server -g
nodemon http-server /javascript/nodemon (a folder to serve up with http-server)

blows up with:

Error: Cannot find module '/javascript/nodemon'
    at Function._resolveFilename (module.js:334:11)
    at Function._load (module.js:279:25)
    at Array.0 (module.js:470:10)
    at EventEmitter._tickCallback (node.js:192:40)

11 Jan 10:43:55 - [nodemon] app crashed - waiting for file changes before starting...

I'm running [email protected] and [email protected]

Error watching ignore file on windows 7 - line 179

I get the following error when i added a .nodemonignore file:

2 Feb 19:10:13 - [nodemon] reading ignore list
2 Feb 19:10:13 - [nodemon] exception in nodemon killing node
Error: use fs.watch api instead
    at Object.watchFile (fs.js:734:11)
    at C:\Users\...\AppData\Roaming\npm\node_modules\nodemon\nodemon.js:179:8
    at Object.oncomplete (path.js:406:19)

Seems to be fixed by changing line 179:

    fs.watchFile(ignoreFilePath, { persistent: false }, readIgnoreFile);

to

    fs.watch(ignoreFilePath, { persistent: false }, readIgnoreFile);

P.S. seems to skip ignore file read completely when trying to use old-style nodemon-ignore file (cannot create files starting with a dot in Windows Explorer so tried the old style).

.nodemonignore file is required

I'm not sure if this was intentional or not, but it appears that having a .nodemonignore file is required for the service to work. Before I added the ignore file my app would startup but wouldn't restart when files changed. Once I added an ignore file, everything works as expected. If you really do need a .nodemonignore file then the docs should be updated to say that.

high cpu usage (about 40% in idle)

Hi,

I tried to monitor my markdown file (REAME.md) to build automatically a pdf file

nodemon --exec "pandoc -o out.pdf" README.md

but nodemon (node) uses 40% of my cpu while idling.

Is this normal?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.