remy / nodemon

Monitor for any changes in your node.js application and automatically restart the server - perfect for development
http://nodemon.io/
MIT License
26.34k stars 1.74k forks source link

nodemon not works with > /dev/null 2>&1 & #2237

Open phbrugnolo opened 1 week ago

phbrugnolo commented 1 week ago

I trying to run this command in WSL2 with Ubuntu 22.04

nohup nodemon --watch ./app/assets/stylesheets/ --ext scss,css --exec yarn build:css > /dev/null 2>&1 &

And seems is not working

Running the same command generating a log i got this error

nohup nodemon --watch ./app/assets/stylesheets/ --ext scss,css --exec yarn build:css > ~/nodemon.log 2>&1 &

nohup: ignoring input [nodemon] 3.1.7 [nodemon] to restart at any time, enter rs [nodemon] watching path(s): app/assets/stylesheets/*/ [nodemon] watching extensions: scss,css [nodemon] starting yarn build:css node:events:496 throw er; // Unhandled 'error' event ^

Error: EBADF: bad file descriptor, read Emitted 'error' event on ReadStream instance at: at emitErrorNT (node:internal/streams/destroy:170:8) at errorOrDestroy (node:internal/streams/destroy:239:7) at node:internal/fs/streams:272:9 at FSReqCallback.wrapper [as oncomplete] (node:fs:671:5) { errno: -9, code: 'EBADF', syscall: 'read' }

Running with --verbose flag the error is the same

And nodemon --dump return


node: v22.11.0 nodemon: 3.1.7 command: /home/social/.nvm/versions/node/v22.11.0/bin/node /home/social/.nvm/versions/node/v22.11.0/bin/nodemon --dump cwd: /home/social/social OS: linux x64

{ run: false, system: { cwd: '/home/social/social' }, required: false, dirs: [ '/home/social/social' ], timeout: 1000, options: { dump: true, ignore: [ '/.git/', '/.nyc_output/', '/.sass-cache/', '/bower_components/', '/coverage/', '/node_modules/', re: /..\/.git\/..|..\/.nyc_output\/..|..\/.sass-cache\/..|..\/bower_components\/..|..\/coverage\/..|..\/node_modules\/../ ], watch: [ '.', re: /.../ ], monitor: [ '.', '!/.git/', '!/.nyc_output/', '!/.sass-cache/', '!/bower_components/', '!/coverage/', '!/node_modules/' ], ignoreRoot: [ '/.git/', '/.nyc_output/', '/.sass-cache/', '/bower_components/', '/coverage/', '/node_modules/' ], restartable: 'rs', colours: true, execMap: { py: 'python', rb: 'ruby', ts: 'ts-node' }, stdin: true, runOnChangeOnly: false, verbose: false, signal: 'SIGUSR2', stdout: true, watchOptions: {}, execOptions: { script: undefined, exec: 'bin/rails server', args: [], scriptPosition: 0, nodeArgs: undefined, execArgs: [], ext: 'js,mjs,cjs,json', env: {} } }, load: [Function (anonymous)], reset: [Function: reset], lastStarted: 0, loaded: [], watchInterval: null, signal: 'SIGUSR2', command: { raw: { executable: 'bin/rails server', args: [] }, string: 'bin/rails server' } }

remy commented 1 week ago

What do you get for the following command:

nohup yarn build:css > /dev/null 2>&1 &
phbrugnolo commented 6 days ago

The code works correctly, and run build as expected