How to do it...

  1. Open a new Terminal
  2. Change the current directory to where your newly created project folder is located
  3. Run the following line to install the chalk package:
      npm --save-exact install chalk

Now, you will be able to use the package in your project via require in Node.js. Go through the following steps to see how you can use it:

  1. Create a new file named index.js and add the following code:
      const chalk = require('chalk') 
      const { red, blue } = chalk 
      console.log(red('hello'), blue('world!')) 
  1. Then, open a new Terminal and run the following:
      node index.js  
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.82.163