NPM Flashcards
What is NPM?
NPM (Node Package Manager) is the world’s largest software registry, center of JavaScript code sharing
Consists of three distinct components:
the website - to discover packages, set up profiles, and manage other aspects of your npm experience,
the CLI - runs from a terminal and how most developers interact with npm, and
the registry - large public database of JavaScript software and the meta-information surrounding it.
What is a package?
Bits of reusable code; A directory which contains one or more files AND a file called package.json with some metadata about this package
How can you create apackage.jsonwithnpm?
npm init –yes
npm init -y
What is a dependency and how to you add one to a package?
A dependency is a library that a project needs to function effectively.
npm install
In package.json file, there is an object calleddependenciesand it consists of all the packages that are used in the project with its version number. So, whenever you install any library that is required in your project that library you can find it in the dependencies object.
What happens when you add a dependency to a package withnpm?
Install the dependencies to the localnode_modulesfolder. By default,’npm install’will install all modules listed in the dependencies property inpackage.json file.