NPM from scratch
Hello! Welcome
Today we are going to learn NPM from scratch
What is NPM?
NPM is the package manager for Node.js (a popular development tool)
A package manager helps you install, share, and manage packages in your projects
What is a package?
A package is a library with code that someone has made public for the rest of us to use
How nice! ❤️
Why use NPM?
With NPM, you can find and use these packages of code created by other developers, and add them to your project
This allows you to save time and avoid reinventing the wheel.
You’re doing great!
Now let’s talk about how to use NPM
Installing NPM
To use NPM, you first need to have Node.js installed on your computer. And… that’s it! You don’t need anything else.
NPM is included with Node.js, so you just need to install Node.js to get started
Managing packages
Now you can use NPM to add, remove, or update packages in your project.
It’s very easy, you just need one command!
Dependencies and versions
NPM also manages dependencies in your project. That is, the libraries that the libraries you use depend on (and so on).
Trust me, it would be an extremely tedious task to do by hand!
But that’s not all!
NPM is also a basic tool for managing your projects. In fact, it is an almost essential tool!
Managing means creating, organizing, updating, and even running your project.
Project management
NPM not only manages packages, it also allows us to create and maintain the structure of the project.
Additionally, many frameworks and libraries provide their own project templates. You run a command and you’re ready to go!
The package.json file
The package.json file is the heart of your NPM project.
It contains information about the project and the dependencies it needs.
Task automation
You can also define custom scripts in your package.json
to automate common tasks (like starting your application or running tests)
In fact, this is something you’ll find in almost every project
Well done!
You now have the basics to use NPM! Keep exploring and make the most of the package ecosystem.