I've had no luck in seeing any results appear in my iTerm2 while trying to use chalk which is a terminal string styling package. I followed all the steps in installing the package but I'm not seeing any colored string result appear when I run a basic console.log("hello");
in my chalk.js
file.
Here is what I am doing.
#!/usr/bin/env node
var chalk = require('chalk');
chalk.blue('Hello world!');
console.log("hello");
Then in iTerm2 I run node chalk.js
and I see no colored strings just plane old boring grey..
Anyone know what I'm doing wrong here?
https://www.npmjs.com/package/chalk
// Importing the chalk module const chalk=require("chalk"); // Coloring different text messages const welcome=chalk. green; const warning=chalk. red; console. log(welcome("Welcome to Tutorials Point")) console.
Chalk functions return a string with the appropriate ANSI escape codes.
You need to console log the result of chalk calls.
console.log(chalk.blue("Hello, world!"));
If you still don't see any color, try running with the command line argument --colors
. If that still doesn't work, set an environment variable FORCE_COLOR=1
.
If it still doesn't work, you're welcome to file a bug report!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With