question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

It's not working on my mac (10.11.5)

See original GitHub issue

This is my code:

const chalk = require('chalk');

console.log(chalk.red('TOTOTOTOT'));
console.log(chalk.blue('Hello world!'));

It just prints white text in iTerm and Terminal

package.json

"chalk": "^1.1.3",

What am I doing wrong here?

Thanks

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:20 (8 by maintainers)

github_iconTop GitHub Comments

8reactions
Qix-commented, May 30, 2016

When you run your script, run it like this:

$ FORCE_COLOR=1 node /path/to/your/script.js

Does it output color?

2reactions
Qix-commented, May 31, 2016

Yes. The child process is piped to the parent process which makes isatty() return 0 (false) within the child process, shutting off colored output thanks to supports-color returning a false-ey result.

Pass an env entry with FORCE_COLOR=1 to the child.

Some pseudo-code:

child_process = ...

if chalk.supportsColor then
    child_process.env.FORCE_COLOR = '1'
endif

That should get you what you want (barring weird edge-cases).

Hope that helps 💃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mac os 10.11.5 installation error - "veri… - Apple Community
I'm quoting below a part of the install.log file that seems to be relevant but from which I cannot understand what is going...
Read more >
16 Common OS X El Capitan Problems & How to Fix Them
We show you how to fix the most common OS X El Capitan problems on your Mac.
Read more >
Common Mac OS X 10.11 El Capitan Problems & Solutions
This article shows you the most common OS X El Capitan problems and provides you detailed solutions to fix these issues.
Read more >
Office for Mac 2016 and El Capitan 10.11.5
I have tried the usual reboot, close and allow rest. Improves things slightly - sometimes a Word file will open for a moment...
Read more >
Should I update my Mac to 10.11.5? - Mac & iPhone Answers
The answer to “Should I update my Mac to 10.11.5?” is easy if you're already on 10.11.0, or 10.11.1, or 10.11.2, or 10.11.3,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found