Nodemon compatibility with io.js? #468

Closed
mitchdenny opened this Issue Jan 18, 2015 · 32 comments

Projects

None yet

6 participants

@mitchdenny

Some folks have reported an issue with compatibility between io.js and nodemon. Might be worth the nodemon maintainers spinning up an install of io.js just to check. It might be easier for you to find the issue since you understand your own app architecture:

nodejs/node#485

@remy
Owner
remy commented Jan 19, 2015

Are you using the execMap for io.js or letting nodemon use the node alias to io.js?

@kyrylkov

Alias: 'nodemon -e html,css,js server.js'

@netmiller

I am using exeMap, but it did't help :

{
  "verbose": true,
  "execMap": {
    "js": "iojs"
  }
}
@remy
Owner
remy commented Jan 19, 2015

Okay, cool, I'll give this another try (I thought I tested it and it worked
tho).

Can you also share what OS you're running with any extra details?
On 19 Jan 2015 06:58, "Esa Laitila" notifications@github.com wrote:

I am using exeMap, but it did't help [image: 👍]

{
"verbose": true,
"execMap": {
"js": "iojs"
}
}


Reply to this email directly or view it on GitHub
#468 (comment).

@kyrylkov

Windows 10 Technical Preview Build 9879 64-bit

@netmiller

Sorry, forgot to mention. Using OS X 10.9.5 and nodemon is installed as global.
If you want some verbose_messages I can send, but I can't see anything suspicious there...

@remy
Owner
remy commented Jan 19, 2015

I'm on Mac OS X 10.9.5 also, and it's working fine for me:

screen shot 2015-01-19 at 19 33 41

I'm using a ~/nodemon.json that looks like this:

{
  "execMap": {
    "js": "iojs"
  }
}

Anyone able to dig a little deeper to work this out with me?

Note that my install process for io.js was:

  1. Install node.js (many months ago).
  2. Install io.js (last week) - noticed that now node on the command line was aliased to iojs, so -
  3. Re-install node, and now I can use node as node and iojs as io.js

I suspect others don't have the step 3, which might be hiding some issue...

@kyrylkov

@remy I don't have node installed at all right now, only io.js

@netmiller

Nodemon get it's output fine, but console.log inside my main.js script is not visible. I have Express-application; haven't tried with pure node. I will do it this evening.

With nodemon :

Esan-iMac:iris$nodemon main.js
19 Jan 21:57:13 - [nodemon] v1.2.1
19 Jan 21:57:13 - [nodemon] reading config /Users/esa/devel/iris/nodemon.json
19 Jan 21:57:13 - [nodemon] to restart at any time, enter `rs`
19 Jan 21:57:13 - [nodemon] ignoring: /Users/esa/devel/iris/.git/**/* /Users/esa/devel/iris/node_modules/**/* bower_components .sass-cache
19 Jan 21:57:13 - [nodemon] watching: *.*
19 Jan 21:57:13 - [nodemon] watching extensions: js
19 Jan 21:57:13 - [nodemon] starting `iojs main.js`
19 Jan 21:57:13 - [nodemon] child pid: 3221
19 Jan 21:57:13 - [nodemon] watching 15,612 files
^C19 Jan 22:04:47 - [nodemon] exiting

and it should be something:

Esan-iMac:iris$node main.js
 >> node-dev-mode-enabled.
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
=> Iris listening on port 9042 /no-SSL/w:dev

js-bson error is due to something with MongoDB (connect-mongo@0.6.0) , but 2 other rows should come by 'console.log'
(f.ex. last row .... => Iris listening on port .....)

@remy
Owner
remy commented Jan 19, 2015

Can you replicate with an io.js script that you can share (via a gist perhaps)?

@netmiller

And with node-supervisor it shows :

Esan-iMac:iris$supervisor main.js

Running node-supervisor with
  program 'main.js'
  --watch '.'
  --extensions 'node,js'
  --exec 'node'

Starting child process with 'node main.js'
Watching directory '/Users/esa/devel/iris' for changes.
 >> node-dev-mode-enabled.
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
=> Iris listening on port 9042 /no-SSL/w:dev

[ .... made some mods here .... ]

crashing child
Starting child process with 'node main.js'
 >> node-dev-mode-enabled.
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
=> Iris listening on port 9042 /no-SSL/w:dev
  • + +

OK, I put mine 'main.js' script in some gist. It takes some time; have not used Gists for a while.

@remy
Owner
remy commented Jan 19, 2015

I'd suggest trying to get it down to something really small and basic - rather than your whole main.js. If only to keep things sane!

@netmiller

Whole 'main.js' is in gist : https://gist.github.com/netmiller/520957cc727950c69a8d

It's not very big script; only a bunch of Express-specific 'require' s etc.
But you can easily find few console.log messages I'm using.

@remy
Owner
remy commented Jan 19, 2015

Yeah, I'd need the package.json for all the deps - which is why I said I
wanted a simple main.js...

On 19 January 2015 at 20:26, Esa Laitila notifications@github.com wrote:

Whole 'main.js' is in gist :
https://gist.github.com/netmiller/520957cc727950c69a8d

It's not very big script; only a bunch of Express-specific 'require' s etc.
But you can easily find few console.log messages I'm using.


Reply to this email directly or view it on GitHub
#468 (comment).

@netmiller

I will try to generate some simple Express-app later this evening.
Meanwhile my package.json is here :

Esan-iMac:iris$cat package.json
{
  "name": "iris",
  "version": "0.9.0",
  "description": "Iris projekti",
  "main": "main.js",
  "dependencies": {
    "archiver": "^0.13.1",
    "async": "^0.9.0",
    "bluebird": "^2.7.1",
    "body-parser": "^1.10.1",
    "byline": "^4.1.1",
    "connect-mongo": "^0.6.0",
    "connect-multiparty": "^1.2.5",
    "cookie-parser": "^1.3.3",
    "csurf": "^1.6.5",
    "debug": "^2.1.1",
    "errorhandler": "^1.3.2",
    "express": "^4.11.0",
    "express-session": "^1.10.1",
    "express-winston": "^0.2.11",
    "he": "^0.5.0",
    "helmet": "^0.5.4",
    "jade": "^1.9.0",
    "jsesc": "^0.5.0",
    "knex": "^0.7.3",
    "lodash": "^2.4.1",
    "mailgun-js": "^0.6.8",
    "marked": "^0.3.2",
    "method-override": "^2.3.1",
    "moment": "^2.9.0",
    "morgan": "^1.5.1",
    "mysql": "^2.5.4",
    "node-uuid": "^1.4.2",
    "nodemailer": "^1.3.0",
    "sax": "^0.6.1",
    "saxpath": "^0.6.1",
    "sendgrid": "^1.5.0",
    "serve-favicon": "^2.2.0",
    "stylus": "^0.49.3",
    "traceback": "^0.3.1",
    "walk": "^2.3.9",
    "winston": "^0.8.3",
    "winston-mongodb": "^0.5.3",
    "xml2js": "^0.4.4"
  },
  "devDependencies": {
    "gulp": "^3.8.10",
    "gulp-concat": "^2.4.3",
    "gulp-sourcemaps": "^1.3.0",
    "gulp-stylus": "^2.0.0",
    "gulp-uglify": "^1.0.2"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Esa.Laitila@netmiller.fi",
  "license": "ISC"
}

Anyway; pure node start works fine, and also supervisor is working without problems. Can't help much, but I'll try to make really simple test script soon.

@remy
Owner
remy commented Jan 19, 2015

Are you using the execMap? I'm assuming not, but just checking.

@remy
Owner
remy commented Jan 19, 2015

@netmiller I ran your package and main.js:

» nodemon main.js
19 Jan 20:53:10 - [nodemon] v1.2.1
19 Jan 20:53:10 - [nodemon] to restart at any time, enter `rs`
19 Jan 20:53:10 - [nodemon] watching: *.*
19 Jan 20:53:10 - [nodemon] starting `iojs main.js`
module.js:324
    throw err;
          ^
Error: Cannot find module './config/server'
    at Function.Module._resolveFilename (module.js:322:15)
    at Function.Module._load (module.js:264:25)
    at Module.require (module.js:351:17)
    at require (module.js:370:17)
    at Object.<anonymous> (/Users/remy/Sites/nodemon/test/fixtures/iojs/main.js:40:18)
    at Module._compile (module.js:446:26)
    at Object.Module._extensions..js (module.js:464:10)
    at Module.load (module.js:341:32)
    at Function.Module._load (module.js:296:12)
    at Function.Module.runMain (module.js:487:10)
19 Jan 20:53:10 - [nodemon] app crashed - waiting for file changes before starting...
@netmiller

OK, I created new Express script according 'Hello World' -tutorial.
Really simple, only 'require' is Express itself.

Here is results :

Esan-iMac:iris$node test10.js
Example app listening at http://:::3000
^C


Esan-iMac:iris$nodemon test10.js
19 Jan 22:45:55 - [nodemon] v1.2.1
19 Jan 22:45:55 - [nodemon] reading config /Users/esa/devel/iris/nodemon.json
19 Jan 22:45:55 - [nodemon] to restart at any time, enter `rs`
19 Jan 22:45:55 - [nodemon] ignoring: /Users/esa/devel/iris/.git/**/* /Users/esa/devel/iris/node_modules/**/* bower_components .sass-cache
19 Jan 22:45:55 - [nodemon] watching: *.*
19 Jan 22:45:55 - [nodemon] watching extensions: js
19 Jan 22:45:55 - [nodemon] starting `iojs test10.js`
19 Jan 22:45:55 - [nodemon] child pid: 3965
19 Jan 22:45:55 - [nodemon] watching 15,613 files

^C
exception in nodemon killing node
Error: write EPIPE
    at Object.exports._errnoException (util.js:732:11)
    at exports._exceptionWithHostPort (util.js:755:20)
    at WriteWrap.afterWrite (net.js:745:14)

----------------------------------------------------------
If appropriate, please file an error with the output from:
$ node /usr/local/bin/nodemon test10.js --dump
At http://github.com/remy/nodemon/issues/new
----------------------------------------------------------

19 Jan 22:46:01 - [nodemon] exiting
Esan-iMac:iris$

and this is my test10.js script :

var express = require('express');
var app = express();

app.get('/', function (req, res) {
  res.send('Hello World!');
});

var server = app.listen(3000, function () {
  var host = server.address().address;
  var port = server.address().port;
  console.log('Example app listening at http://%s:%s', host, port);
});

No dependencies; only I created this script to same directory where are all my deps with "full app". But it should't make difference, or am I missing something.

  • + +

Yes, I'm using execMap .

@remy
Owner
remy commented Jan 19, 2015

I get this (with your updated main.js):

» nodemon main.js
19 Jan 20:55:18 - [nodemon] v1.2.1
19 Jan 20:55:18 - [nodemon] to restart at any time, enter `rs`
19 Jan 20:55:18 - [nodemon] watching: *.*
19 Jan 20:55:18 - [nodemon] starting `iojs main.js`
Example app listening at http://:::3000

What do you see (can you paste)?

@netmiller

Try this test10.js script, and install only latest Express.
I will do the same into clean directory.

@remy
Owner
remy commented Jan 19, 2015

Can you share your /Users/esa/devel/iris/nodemon.json file too (if that's suitable)?

@netmiller

This is all I got into terminal (test10.js) :

Esan-iMac:iris$nodemon test10.js
19 Jan 22:57:14 - [nodemon] v1.2.1
19 Jan 22:57:14 - [nodemon] reading config /Users/esa/devel/iris/nodemon.json
19 Jan 22:57:14 - [nodemon] to restart at any time, enter `rs`
19 Jan 22:57:14 - [nodemon] ignoring: /Users/esa/devel/iris/.git/**/* /Users/esa/devel/iris/node_modules/**/* bower_components .sass-cache
19 Jan 22:57:14 - [nodemon] watching: *.*
19 Jan 22:57:14 - [nodemon] watching extensions: js
19 Jan 22:57:14 - [nodemon] starting `iojs test10.js`
19 Jan 22:57:14 - [nodemon] child pid: 4016
19 Jan 22:57:14 - [nodemon] watching 15,613 files

and here is nodemon.json

Esan-iMac:iris$cat nodemon.json
{
  "verbose": true,
  "execMap": {
    "js": "iojs"
  }
}
@netmiller

Don't understand what is the difference; trying to install same into clean dir soon.

@remy
Owner
remy commented Jan 19, 2015

Hmm, weird. I might try to reinstall iojs (which will kill off node), there might be something in that.

@netmiller

Making new/clean directory and installing Express (nothing else) and copying simple 'test10.js' into it :

Esan-iMac:test24$npm install express
express@4.11.0 node_modules/express
├── merge-descriptors@0.0.2
...etc

Esan-iMac:test24$cp ~/devel/iris/test10.js .

Esan-iMac:test24$node test10.js
Example app listening at http://:::3000
^C

Esan-iMac:test24$nodemon test10.js
19 Jan 23:04:10 - [nodemon] v1.2.1
19 Jan 23:04:10 - [nodemon] to restart at any time, enter `rs`
19 Jan 23:04:10 - [nodemon] watching: *.*
19 Jan 23:04:10 - [nodemon] starting `node test10.js`

^C
exception in nodemon killing node
Error: write EPIPE
    at Object.exports._errnoException (util.js:732:11)
    at exports._exceptionWithHostPort (util.js:755:20)
    at WriteWrap.afterWrite (net.js:745:14)

----------------------------------------------------------
If appropriate, please file an error with the output from:
$ node /usr/local/bin/nodemon test10.js --dump
At http://github.com/remy/nodemon/issues/new
----------------------------------------------------------

Still this 'console.log' is not visible running via nodemon.
This time I have't execMap, but nodemon is still installed as global?
Can it make some difference; I guess no....

@netmiller

Tried to install nodemon locally, but no difference (= no 'console.log' output).
It must be something with iojs.
Maybe I can install latest node again and test if it works with "pure" Node.js.

@netmiller

Yes, one step forward. Installed pure Node .pkg (v.0.10.33) and simple 'test10.js' works now. It must be inside 'iojs.js'.

Esan-iMac:test24$node -v
v0.10.33

Esan-iMac:test24$nodemon test10.js
19 Jan 23:15:49 - [nodemon] v1.2.1
19 Jan 23:15:49 - [nodemon] to restart at any time, enter `rs`
19 Jan 23:15:49 - [nodemon] watching: *.*
19 Jan 23:15:49 - [nodemon] starting `node test10.js`
Example app listening at http://0.0.0.0:3000

No 'execMap', and my /usr/local/bin seems :

Esan-iMac:bin$pwd
/usr/local/bin

Esan-iMac:bin$ls -lad io* node*
-rwxrwxr-x  1 root   wheel  15749008 16 Tam 06:57 iojs
-rwxr-xr-x  1 24561  wheel  21511664 23 Lok 21:10 node
lrwxr-xr-x  1 esa    admin        49 16 Tam 12:49 node-supervisor -> ../lib/node_modules/supervisor/lib/cli-wrapper.js
lrwxr-xr-x  1 esa    admin        42 16 Tam 11:32 nodemon -> ../lib/node_modules/nodemon/bin/nodemon.js
@remy
Owner
remy commented Jan 19, 2015

Confirmed it by installing iojs over node.js - and it kills output.

I will investigate.

@remy remy added a commit that closed this issue Jan 19, 2015
@remy Fixed #468
My old spawn check was based on the minor value being >= 8, of course now io.js is 1.0.2, it wasn't using the new spawn method, and silencing user scripts.
3feff50
@remy remy closed this in 3feff50 Jan 19, 2015
@remy
Owner
remy commented Jan 19, 2015

Fixed and landed in nodemon@1.3.1.

@netmiller

Très bien, excellent work. Going forward with iojs and hoping all bugs fixed like you did =:)

@wavded
wavded commented Jan 20, 2015

thx @remy

@trevorstarick

Awesome! Thanks @remy

@dougwilson dougwilson referenced this issue in expressjs/morgan Feb 24, 2015
Closed

io.js compatibility #54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment