Course Banner

PnPM Installation

Introduction

As explained in the readings for this week, PnPM is a package manager used with Node. This software allows you to add, remove, update packages that are needed for your application and to enhance the functionality of Node.

Video Demonstration

Watch the video to obtain a general idea, but follow the written steps to complete the activity. This is the Transcript of the video.

Check Node Version

Prior to installing Pnpm, ensure that NodeJS is up-to-date. If you just installed NodeJS, then skip this step. If you have had NodeJS installed for a while, please do this:

  1. Open Terminal (Mac) or Command Prompt (Windows).
  2. For Windows users, open Command Prompt as an Administrator.
  3. Type "node -v", press Enter.
  4. Open nodejs.org in a browser window.
  5. Compare the version number on your computer against the LTS version number on the website. If they are the same, no need to update. If they are not the same, click and download the LTS version. Once downloaded, install.

Now, you're ready to install pnpm.

Pnpm Installation Directions

Because you just installed Node, it comes with a program named "Corepack", which is software for managing package managers. Let's use it to activate PnPM, rather than downloading a second version.

  1. Open the Terminal or Command Prompt
  2. Type corepack enable, press "Enter".
  3. This will automatically install pnpm on your system. However, it probably won't be the latest version of pnpm. To upgrade it, type the following, then press "Enter":
  4. corepack prepare pnpm@latest --activate
  5. If you receive an error after typing the code in number 2, go ahead and type the code found in number 4.
  6. When done, type pnpm --version, hit "Enter".
  7. You should see a line that indicates version 6.x or higher

Alternate Installation Process

A few students report errors when trying to enable using corepack. If you run into this error, then:

Conclusion

Whew, I'm glad that's done, and I bet you are too! Congratulations on getting PnPM activated. You're now ready to move on. If, the installation failed, get help to get it installed.