</>
Skip to content
Node.js lessons (11/44)

Node.js — Packages

Installing Packages

npm install express           # Production
npm install -D jest           # Development
npm install lodash@4.17.21    # Specific version
npm install github:user/repo  # GitHub

Popular Packages

PackageDescription
expressWeb framework
lodashUtility library
axiosHTTP client
momentDate library
dotenvEnvironment variables
mongooseMongoDB ODM
jestTesting framework

Creating a Package

{
  "name": "my-package",
  "version": "1.0.0",
  "main": "index.js",
  "keywords": ["utility"],
  "author": "Your Name",
  "license": "MIT"
}

Publishing

npm login
npm publish

package.json Fields

FieldDescription
namePackage name
versionSemantic version
mainEntry point
dependenciesProduction deps
devDependenciesDev deps
scriptsnpm commands
keywordsSearch terms
licenseLicense type

Mini Practice

  1. Install popular packages
  2. Create your own package
  3. Add scripts to package.json
  4. Publish a package to npm

Up Next

Continue with package.json — understanding package.json.

Related Topics

Frequently Asked Questions about Packages

What is Packages in Node.js?

Packages is a fundamental concept in Node.js. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Packages?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Packages.

Why is Packages important in Node.js?

Packages is essential for Node.js development. Understanding this concept will help you write better code and solve real-world problems more effectively.