02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School

Getting to Know NPM

Learn how to work with NPM, including updating versions, installing and uninstalling global packages, and managing dependencies with package.json.

Duration: 38:29

Created with

Ben Fhala

Ben Fhala

Ben Fhala is the creative force and founder behind 02geek, a pioneering platform dedicated to making web development accessible to everyone. With over 18 years of experience in the industry, Ben has a deep passion for teaching and a knack for breaking down complex concepts into easy-to-understand lessons.

Getting to Know NPM Overview

What you'll learn

Getting to Know NPM

In this chapter, you will learn how to work effectively with NPM (Node Package Manager), which is an essential tool for managing dependencies in Node.js projects. NPM helps developers install, update, and manage packages, making it a critical part of any JavaScript project. Whether you're working on a simple script or a full stack application, understanding NPM will make your development process smoother and more efficient.

We begin by showing you how to update your NPM version to ensure you're using the latest features and security patches. Keeping your tools updated is important for avoiding compatibility issues and taking advantage of recent improvements. This section will guide you through the commands needed to update NPM and explain why regular updates are crucial for modern JavaScript development.

Next, we cover the process of installing and uninstalling global packages. Global packages are useful for tools that you need to access from anywhere on your system, such as linters or task runners. You will learn how to manage these packages effectively, allowing you to use them across different projects without needing to reinstall each time.

We then dive into the differences between global and local packages. Understanding when to use a package globally or locally is key to managing dependencies properly. This section will help you determine which type of installation is best for your needs, reducing conflicts and ensuring the stability of your projects.

The chapter also includes a detailed walkthrough of declaring NPM packages using package.json. The package.json file is the backbone of any Node.js project, and knowing how to use it effectively is critical for managing project dependencies, setting version ranges, and creating custom scripts. This section provides insights into the various properties in the package.json file and how to declare dependencies for development and production environments.

Finally, we discuss version controlling packages to keep your dependencies in sync across environments. You'll learn best practices for managing package versions, updating safely, and using package-lock.json to ensure consistency. This will help you avoid breaking changes and ensure that all team members are using the same versions of your project's dependencies.

By the end of this chapter, you'll have a thorough understanding of how to use NPM to manage your projects effectively. You'll be able to confidently update, install, and control the versions of packages you need, ensuring a stable and organized development environment.

Updating Your NPM Version

Learn how to update your NPM version to access the latest features and security patches for modern JavaScript development.

13:46

Installing and Uninstalling Global Packages with NPM

Learn how to install, list, and remove global packages using NPM, including tools like linters and task runners.

06:30

Understanding Global and Local Packages in NPM

Learn the differences between global and local packages in NPM, when to use each, and best practices for managing Node.js dependencies.

04:42

Declaring NPM Packages with package.json

Learn how to declare NPM packages using the package.json file, add dependencies, and understand the properties of package.json.

09:10

Version Controlling Packages in NPM

Learn how to version control packages in NPM, manage dependencies, update safely, and keep your project dependencies in sync.

09:29