0

Does anyone know how to run 'nodemon' to be displaying console colors using npm 'colors' package ? is it possible ?

Only today I found out about the existence of 'colors' package that allows to log out colorful strings into console, which make things a lot more readable to me. Unfortunately, when I run my app using nodemon, colors not working. When I run my app simply using node, then colors are working properly.

  • colors version 1.1.2
  • nodemon version 1.11
  • git version 2.8.1.windows.1

Thanks

mattK
  • 73
  • 6

2 Answers2

1

You can try running nodemon without its own colors: nodemon --no-colors test.js. I tested it out on a Mac and had no issues. (Sorry, I don't have a Windows box to test on.)

Not necessarily a solution to the actual problem you're facing but it's probably best to use a module that is still updated like chalk.

jcragun
  • 2,060
  • 10
  • 8
  • Didn't find a solution. Tried chalk as you recommended, and will stick with that for now. thx! – mattK May 18 '17 at 08:58
0

Not necessarily a solution to the OP but if someone wants a coloured output on console for better readability: ( solution i wanted to implement ) you can do something like:

const color = '\x1b[36m%s\x1b[0m';
console.log(color, 'some console content');

It works with nodemon and pm2 (tested: git windows ) Ref: How to change node.js's console font color?

coldcoder8502
  • 77
  • 1
  • 5