NPM Flashcards
What is NPM?
It is the world’s largest software registry, developers use npm to share software
It’s a way to share code with other developers
Consists of 3 distinct components:
The website
The Command Line Interface (CLI)
The registry
What is a package?
Reusable Code
A directory with one or more files in it that also has a package.json with some metadata about the package
How can you create a package.json with npm?
Run the commands:
cd /path/to/package
npm init -y —–or—– npm init –yes
What is a dependency and how do you add one to a package?
A dependency is packages required by your application in production
You can edit your package.json manually or use the command while in your specified directory
npm install
What happens when you add a dependency to a package with npm?
It adds a folder and updates your package.json with a dependency key value
“dependencies:” {
“jquery”: “^3.6.0”
}