Nodemon: process.stdin.setRawMode is undefined when running in nodemon

Created on 14 Jun 2018  路  2Comments  路  Source: remy/nodemon

I have an app that runs perfectly under node but fails under nodemon. The problem is that process.stdin.setRawMode is set to undefined when running nodemon. Here's a test script (x.js)...

console.log(process.stdout.isTTY)
console.log(process.stdin.setRawMode)

When I run node x.js, I get...

[Function]

When I run ./node_modules/.bin/nodemon x.js, I get...

undefined

Not that it should make a difference, but I'm running this on a Raspberry Pi (ARM) with the most recent version of Raspbian

Here's the dump...

node: v8.11.2
nodemon: 1.17.5
command: /usr/local/bin/node /home/pi/myproj/node_modules/.bin/nodemon --dump x.js
cwd: /home/pi/myproj
OS: linux arm
--------------
{ run: false,
  system: { cwd: '/home/pi/myproj' },
  required: false,
  dirs: [ '/home/pi/myproj' ],
  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: /.*\..*/ ],
     ignoreRoot: 
      [ '**/.git/**',
        '**/.nyc_output/**',
        '**/.sass-cache/**',
        '**/bower_components/**',
        '**/coverage/**',
        '**/node_modules/**' ],
     restartable: 'rs',
     colours: true,
     execMap: { py: 'python', rb: 'ruby' },
     stdin: true,
     runOnChangeOnly: false,
     verbose: false,
     signal: 'SIGUSR2',
     stdout: true,
     watchOptions: {},
     execOptions: 
      { script: 'x.js',
        exec: 'node',
        args: [],
        scriptPosition: 0,
        nodeArgs: undefined,
        execArgs: [],
        ext: 'js,mjs,json',
        env: {} },
     monitor: 
      [ '*.*',
        '!**/.git/**',
        '!**/.nyc_output/**',
        '!**/.sass-cache/**',
        '!**/bower_components/**',
        '!**/coverage/**',
        '!**/node_modules/**' ] },
  load: [Function],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [],
  watchInterval: null,
  signal: 'SIGUSR2',
  command: 
   { raw: { executable: 'node', args: [ 'x.js' ] },
     string: 'node x.js' } }
--------------

Most helpful comment

Have you tried with the --no-stdin flag set? Equally, you can try with --spawn flag too.

All 2 comments

Have you tried with the --no-stdin flag set? Equally, you can try with --spawn flag too.

The --no-stdin seems to work. I didn't see that option when I did --help. Thanks for the pointer

Was this page helpful?
0 / 5 - 0 ratings