docker-compose-nodejs-examples icon indicating copy to clipboard operation
docker-compose-nodejs-examples copied to clipboard

There is a problem with nodemon

Open miguelemosreverte opened this issue 8 years ago • 3 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 | > [email protected] 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! [email protected] start: nodemon -L app/bin/www web_1 | npm ERR! Exit status 8 web_1 | npm ERR! web_1 | npm ERR! Failed at the [email protected] 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

miguelemosreverte avatar Sep 30 '17 05:09 miguelemosreverte

I'm still seeing this issue

smergler avatar Nov 05 '17 17:11 smergler

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  | > [email protected] 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! [email protected] start: `nodemon -L app/bin/www`
web_1  | npm ERR! Exit status 8
web_1  | npm ERR! 
web_1  | npm ERR! Failed at the [email protected] 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

zipzit avatar Dec 05 '17 08:12 zipzit

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.

zipzit avatar Dec 05 '17 10:12 zipzit

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

janvt avatar Mar 07 '23 10:03 janvt