GithubHelp home page GithubHelp logo

remy / nodemon Goto Github PK

View Code? Open in Web Editor NEW
26.0K 259.0 1.7K 2.72 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 82.00% HTML 15.13% Dockerfile 0.38% Shell 0.09% CSS 0.86% jq 1.54%
nodemon watch node hacktoberfest

nodemon's Issues

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.

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.

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 

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?

.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.

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 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)

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.

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 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.

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

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

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...

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?

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

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

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?

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).

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.

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

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?

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 :)

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]

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)

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

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

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)!

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.

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

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.

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.

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

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.

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.

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?

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.

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?

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.