How to Install PNPM on Linux ARM64 System

Cover Image for How to Install PNPM on Linux ARM64 System

Installing software on Linux systems that use the ARM64 architecture can sometimes feel challenging, especially if you are new to working with this setup. But it doesn't have to be. If you are looking to install pnpm on a Linux ARM64 system, you’re in the right place.

pnpm is a fast and efficient package manager for Node.js that saves disk space and improves speed by using symlinks to avoid duplicating dependencies. Installing it on ARM64 architecture is quite simple once you understand the process.

In this guide, I will walk you through everything you need to know about installing pnpm on Linux ARM64 systems, making the process as easy as possible.

Understanding ARM64 and Why You Might Be Using It

First, let's talk briefly about the ARM64 architecture. ARM64 is a 64-bit architecture used in many devices, especially modern Raspberry Pis, Chromebooks, and some Linux servers. It's known for its energy efficiency, making it a popular choice for smaller devices and specific cloud-based environments.

If you're using a device with an ARM64 processor, you might already be familiar with its benefits in terms of power consumption and processing efficiency. However, working on ARM64 systems can sometimes be different from more common architectures like x86, and certain software installations need to be tailored for this architecture. That’s why following the right process to install tools like pnpm is important.

What is pnpm and Why Use It?

Before diving into the installation, let’s briefly cover why you might want to use pnpm over other package managers like npm or yarn.

pnpm stands for “Performant npm” and is known for being extremely fast and space-efficient. Instead of duplicating dependencies across multiple projects, pnpm uses a single content-addressable storage system. This means it saves disk space and can install packages faster than npm or yarn.

For developers working on ARM64-based systems, using a fast and efficient package manager like pnpm can make a huge difference in development speed.

Step 1: Preparing Your ARM64 Linux System

Before installing pnpm, you need to ensure that your Linux system is ready for the installation. Follow these steps:

Update the Package List

Start by updating your system's package list. Open your terminal and run the following command:

sudo apt update

This will make sure that your system has the latest information about available packages, which is crucial before installing anything new.

Install Node.js

Since pnpm is a package manager for Node.js, you need to have Node.js installed on your ARM64 system before you can proceed. To install Node.js on your Linux ARM64 system, follow these steps:

  1. Install curl (if it’s not installed already):

     sudo apt install curl
    
  2. Download and install Node.js for ARM64 from the NodeSource repository:

     curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
     sudo apt install -y nodejs
    

    This command will install Node.js version 16.x, which is the recommended stable version for most projects. If you need a different version, you can replace 16.x with the version you need.

  3. Verify the installation:

    After installation, check that Node.js and npm are installed correctly by running:

     node -v
     npm -v
    

    You should see version numbers for both Node.js and npm.

Step 2: Installing pnpm on Linux ARM64

Once Node.js is installed, the next step is to install pnpm. There are several methods to install pnpm, but the easiest and most recommended method on Linux ARM64 is through the command line.

Using the Install Script

The simplest way to install pnpm is by running its official installation script. This script works well on most Linux distributions, including those using ARM64.

  1. Open your terminal and run the following command:

     curl -fsSL https://get.pnpm.io/install.sh | sh -
    

    This command downloads and runs the official pnpm install script. It automatically detects your system’s architecture and installs the correct version for ARM64.

  2. Once the installation is complete, you need to ensure that pnpm is added to your system's path. The script should do this automatically, but you can verify it by adding the following line to your shell configuration file (e.g., .bashrc or .zshrc):

     export PATH="$HOME/.local/share/pnpm:$PATH"
    

    Then, reload your shell configuration file:

     source ~/.bashrc
    
  3. Verify the installation:

    To confirm that pnpm was installed correctly, run:

     pnpm -v
    

    If installed successfully, this will return the version number of pnpm.

Alternative Installation Methods

In case you prefer to use npm to install pnpm, here’s how you can do it:

  1. Install pnpm using npm:

    Since npm is already installed with Node.js, you can use it to install pnpm:

     npm install -g pnpm
    
  2. Verify the installation:

    After installation, confirm that pnpm is installed by running:

     pnpm -v
    

    This should return the version number, showing that the installation was successful.

Step 3: Using pnpm on ARM64

Now that pnpm is installed, you can start using it to manage your Node.js packages. Here are a few basic commands to get you started:

  1. Installing a package:

    To install a package using pnpm, run the following command:

     pnpm install <package-name>
    

    For example, to install the Express.js framework:

     pnpm install express
    
  2. Installing all dependencies:

    If you have a package.json file and want to install all the listed dependencies, run:

     pnpm install
    

    This is similar to how you would use npm, but faster and more space-efficient.

  3. Adding a dev dependency:

    To add a package as a development dependency, use the -D flag:

     pnpm add <package-name> -D
    

    For example, to install ESLint as a dev dependency:

     pnpm add eslint -D
    

Step 4: Updating pnpm on Linux ARM64

To keep pnpm up to date, you can run the following command:

pnpm install -g pnpm

This ensures that you always have the latest version of pnpm installed on your ARM64 system.

Conclusion

Installing pnpm on a Linux ARM64 system is straightforward, and it brings many benefits, especially when managing large Node.js projects. By following the steps outlined in this guide, you can have pnpm up and running in no time.

Whether you’re using it for small projects or more complex development work, pnpm provides a fast and efficient way to manage your Node.js dependencies on ARM64-based Linux systems.

Now that you’ve successfully installed it, you can take full advantage of pnpm’s speed and disk-saving features. Happy coding!