add Verified current stable Not installed? Package Management

Add / Download Package Globally

Download Package Globally

Installs a package globally, making it accessible system-wide.

$
Terminal
pnpm add <module_name> -g

When To Use

When requiring a CLI tool available across multiple projects.

Pro Tip

Be cautious of global installations that may conflict with local versions; use `--no-global` for isolation if needed.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
pnpm add <module_name> -g

Anatomy of Output

Understanding the result

+ global-package@1.0.0 Package

Indicates successful global installation.

added 1 package in 150ms Stats

Time taken for adding the global package.

# Install location: /usr/local/lib/node_modules Location

Path to global package installation.

Troubleshooting

Common pitfalls

ERR_PNPM_GLOBAL_INSTALL: Cannot install globally without proper permissions

Solution: Use `sudo` or check your Node.js installation permissions.

ERR_PNPM_NO_PACKAGE: Package not found in registry

Solution: Ensure the package name is correct or available in the registry.

ERR_PNPM_PKG_VERSION_INVALID: Invalid package version specified

Solution: Check your version syntax; it must follow semver standards.

Command Breakdown

What each part is doing

pnpm
Base Command
The executable that performs this operation. Here it runs Add before the shell applies any redirect operators.
<module_name>
module name
The value supplied for module name.
-g
g| global
The value supplied for g| global.
-g
Command Option
Tool-specific option used by this command invocation.

Alternative Approaches

Comparable commands in other tools

Alternative package management tools for the same job.