Skip to content

npm

Course: Node.js Runtime - chapter 4

The full form of NPM is Node Package Manager.

It is a package manager for JavaScript, primarily used for managing libraries and dependencies in Node.js projects. NPM allows developers to easily install, update, and manage packages of reusable code

💡 package managers are an important concept in programming languages/runtimes. For eg the package manager of rust is cargo

Uses of npm

  • Initializing a project
npm init
  • Running scripts
npm run test
  • Installing external dependencies
npm install chalk
  • Write some code
const chalk = require('chalk');
console.log(chalk.blue('Hello, world!'));
console.log(chalk.red.bold('This is an error message.'));
console.log(chalk.green.underline('This is a success message.'));