Node.js
Basic NPM Commands in Node.js
Basic NPM Commands
34
#description
In this course on Node.js, one of the topics covered is basic NPM commands. NPM (short for Node Package Manager) is a package manager for the JavaScript programming language. It is used for installing, updating, and managing packages (i.e. libraries, frameworks, tools, etc.) that are built on top of Node.js.
Some of the basic NPM commands that are covered in the course include:
npm init
- This command is used to initialize a new Node.js project, and creates apackage.json
file that contains information about the project and its dependencies.
npm install
- This command is used to install the dependencies listed in thepackage.json
file. By default, it installs the dependencies locally in thenode_modules
directory.
npm install <package_name>
- This command is used to install a specific package from the NPM registry, and adds it to thedependencies
section of thepackage.json
file.
npm install <package_name> --save-dev
- This command is used to install a package as a development dependency, and adds it to thedevDependencies
section of thepackage.json
file.
npm update
- This command is used to update the dependencies listed in thepackage.json
file to their latest versions.
npm uninstall <package_name>
- This command is used to uninstall a package, and removes it from thedependencies
ordevDependencies
section of thepackage.json
file.
By using these basic NPM commands, developers can easily manage their Node.js projects and dependencies, and keep them up-to-date with the latest versions.
March 25, 2023