There is a problem with nodemon
miguelemosreverte opened this issue · 4 comments
I developed a project on top of this, and a few months ago I started having this problem. For a while I though it was a bug on my end, but after downloading a fresh clone of this project it seems I can replicate the bug. Here is the output of running docker-compose up on the first example, 01-express-nodemon:
Starting 01expressnodemon_web_1 ...
Starting 01expressnodemon_web_1 ... done
Attaching to 01expressnodemon_web_1
web_1 |
web_1 | > app@0.0.0 start /src
web_1 | > nodemon -L app/bin/www
web_1 |
web_1 |
web_1 | /usr/local/lib/node_modules/nodemon/node_modules/update-notifier/index.js:2
web_1 | const spawn = require('child_process').spawn;
web_1 | ^^^^^
web_1 | SyntaxError: Use of const in strict mode.
web_1 | at Module._compile (module.js:439:25)
web_1 | at Object.Module._extensions..js (module.js:474:10)
web_1 | at Module.load (module.js:356:32)
web_1 | at Function.Module._load (module.js:312:12)
web_1 | at Module.require (module.js:364:17)
web_1 | at require (module.js:380:17)
web_1 | at Object. (/usr/local/lib/node_modules/nodemon/bin/nodemon.js:15:1)
web_1 | at Module._compile (module.js:456:26)
web_1 | at Object.Module._extensions..js (module.js:474:10)
web_1 | at Module.load (module.js:356:32)
web_1 |
web_1 | npm ERR! Linux 4.10.0-33-generic
web_1 | npm ERR! argv "node" "/usr/local/bin/npm" "start"
web_1 | npm ERR! node v0.10.38
web_1 | npm ERR! npm v2.11.1
web_1 | npm ERR! code ELIFECYCLE
web_1 | npm ERR! app@0.0.0 start:nodemon -L app/bin/www
web_1 | npm ERR! Exit status 8
web_1 | npm ERR!
web_1 | npm ERR! Failed at the app@0.0.0 start script 'nodemon -L app/bin/www'.
web_1 | npm ERR! This is most likely a problem with the app package,
web_1 | npm ERR! not with npm itself.
web_1 | npm ERR! Tell the author that this fails on your system:
web_1 | npm ERR! nodemon -L app/bin/www
web_1 | npm ERR! You can get their info via:
web_1 | npm ERR! npm owner ls app
web_1 | npm ERR! There is likely additional logging output above.
web_1 |
web_1 | npm ERR! Please include the following file with any support request:
web_1 | npm ERR! /src/npm-debug.log
01expressnodemon_web_1 exited with code 1
I'm still seeing this issue
I am also seeing odd nodemon errors when attempting to run the 01-express-nodemon example in a clean install. I've glanced over the chevdor proposals, and yes that makes the nodemon errors disappear, by not running nodemon at all. Not really a fix (and profuse apologies if I have that wrong, I'm learning this stuff too...)
My error messages:
$ docker-compose up
Creating 01expressnodemon_web_1 ...
Creating 01expressnodemon_web_1 ... done
Attaching to 01expressnodemon_web_1
web_1 |
web_1 | > app@0.0.0 start /src
web_1 | > nodemon -L app/bin/www
web_1 |
web_1 |
web_1 | /usr/local/lib/node_modules/nodemon/lib/config/exec.js:159
web_1 | .map(ext => ext.replace(/^\./, ''))
web_1 | ^
web_1 | SyntaxError: Unexpected token >
web_1 | at Module._compile (module.js:439:25)
web_1 | at Object.Module._extensions..js (module.js:474:10)
web_1 | at Module.load (module.js:356:32)
web_1 | at Function.Module._load (module.js:312:12)
web_1 | at Module.require (module.js:364:17)
web_1 | at require (module.js:380:17)
web_1 | at Object.<anonymous> (/usr/local/lib/node_modules/nodemon/lib/config/load.js:8:12)
web_1 | at Module._compile (module.js:456:26)
web_1 | at Object.Module._extensions..js (module.js:474:10)
web_1 | at Module.load (module.js:356:32)
web_1 |
web_1 | npm ERR! Linux 4.9.49-moby
web_1 | npm ERR! argv "node" "/usr/local/bin/npm" "start"
web_1 | npm ERR! node v0.10.38
web_1 | npm ERR! npm v2.11.1
web_1 | npm ERR! code ELIFECYCLE
web_1 | npm ERR! app@0.0.0 start: `nodemon -L app/bin/www`
web_1 | npm ERR! Exit status 8
web_1 | npm ERR!
web_1 | npm ERR! Failed at the app@0.0.0 start script 'nodemon -L app/bin/www'.
web_1 | npm ERR! This is most likely a problem with the app package,
web_1 | npm ERR! not with npm itself.
web_1 | npm ERR! Tell the author that this fails on your system:
web_1 | npm ERR! nodemon -L app/bin/www
web_1 | npm ERR! You can get their info via:
web_1 | npm ERR! npm owner ls app
web_1 | npm ERR! There is likely additional logging output above.
web_1 |
web_1 | npm ERR! Please include the following file with any support request:
web_1 | npm ERR! /src/npm-debug.log
01expressnodemon_web_1 exited with code 1
Update: I'm continuing to play with this, and totally got it running correctly with a single line of code change. In the file docker-compose-nodejs-examples/01-express-nodemon/Dockerfile simply change the first line of code:
FROM node:0.10.38
to a more modern docker image . I chose
FROM node:9.2.0
When I did that WITHOUT any other changes within the 01-express-nodemon repository, the code ran without errors. Note there are other warnings, e.g. jade --> pug, but that can all be fixed. After the install, I change one line of code (let's use myApp --> routes/index.js... change title: Express to title: Express wow, now with Nodemon Restarts!) When I save the file, I see and immediate server restart. A simple refresh in the browser shows the change. This does not refresh the browser/client automatically.
We have modernized this project, please check if the issue still persists in the new version and re-open if necessary. Thanks for your contribution! :)