TemperStack
Beginner8 min readUpdated Mar 13, 2026

How to Install Netlify CLI

Quick Answer

Install Netlify CLI globally with npm install netlify-cli -g (requires Node.js 18.14.0+). Verify installation with netlify --version, then authenticate with netlify login to grant CLI access to your Netlify account.

Prerequisites

  1. Node.js version 18.14.0 or later
  2. npm 8 or higher
  3. Stable internet connection
  4. Terminal or command line access
  5. Netlify account
1

Verify Node.js Installation

Before installing Netlify CLI, confirm you have Node.js version 18.14.0 or later installed on your system. Run node --version in your terminal to check your current version. If you need to install or upgrade Node.js, visit the official Node.js website or use a version manager like nvm.

Tip
Node.js versions 20.x and later are recommended for the best compatibility.
2

Install Netlify CLI Globally

Run the following command from any directory in your terminal to install Netlify CLI globally:

npm install netlify-cli -g

This makes the netlify command available from any directory on your system. The installation may take a few minutes as npm downloads and installs all required dependencies.

Tip
On macOS with Homebrew installed, you can alternatively run brew install netlify-cli.
3

Verify the Installation

Confirm that Netlify CLI installed successfully by running:

netlify --version

This command displays the installed CLI version and basic information about the tool. If you see a version number, the installation was successful.

Tip
You can also run netlify help to view all available commands.
4

Authenticate with Netlify

Log in to your Netlify account from the command line by running:

netlify login

This command opens a browser window where you can log in with your Netlify credentials and grant access to Netlify CLI. Complete the authentication process in your browser, and the CLI will automatically store your access token locally.

Tip
Keep your browser window open until authentication completes to avoid connection timeouts.
5

Locate Your Configuration File

After authentication, Netlify CLI stores your access token in a config.json global configuration file. The location depends on your operating system:

macOS: Library/Preferences/netlify/config.json

Linux: .config/netlify/config.json

Windows: AppData\Roaming\netlify\Config\config.json

The CLI uses this token automatically for all future commands, so you won't need to log in again.

Tip
Do not share or commit this config.json file to public repositories as it contains your authentication token.
6

Link Your Project (Optional)

If you have an existing local project, navigate to your project directory and run:

netlify link

This command connects your local project to a Netlify site and adds a siteId field to a new .netlify/state.json file in your project folder. This step is optional but recommended for easier deployments.

Tip
Alternatively, use netlify clone to clone a Netlify site repository and automatically link it in one step.
7

Install for CI Environments (Optional)

If you're using Netlify CLI in a continuous integration environment like GitHub Actions or CircleCI, install it as a local development dependency instead of globally:

npm install --save-dev netlify-cli

This approach binds a specific CLI version to your project and ensures reproducible builds across different machines. Always use a lock file (package-lock.json or yarn.lock) with this method.

Tip
Use automated tools like Renovate or Dependabot to manage CLI version updates in CI environments.
8

Test Your Installation

Run a test command to ensure everything is working correctly:

netlify status

This command displays information about your linked Netlify site and confirms that your authentication token is valid. If you see site details, your installation and authentication are complete.

Tip
If you haven't linked a project yet, this command will prompt you to do so.

Troubleshooting

ERR_MODULE_NOT_FOUND error during installation on Node 20.x
Update Netlify CLI to version 19.1.3 or later with npm install -g netlify-cli@latest. Clear your npm cache with npm cache clean --force and reinstall. This issue was fixed in v19.1.3.
Sharp dependency build failures or timeout errors on Linux
Install required build tools with sudo apt install build-essential python3 on Ubuntu/Debian. Ensure you have at least 500MB free disk space and 4GB+ RAM. Update Node.js and npm to their latest versions.
Out-of-memory (OOM) kills during installation
Increase available RAM or free up disk space (target 500MB+ free). Try installing with npm install netlify-cli -g --no-optional to skip optional dependencies, or use nvm to switch to a different Node.js version.
netlify command not found after installation
Verify installation with npm list -g netlify-cli. Check that npm's global prefix is in your system PATH. On macOS/Linux, run echo $PATH and ensure it includes your npm global directory. Restart your terminal after installation.
Authentication fails or token not stored
Ensure your internet connection is stable and you have write permissions to your home directory. Try clearing npm cache with npm cache clean --force and running netlify login again. Check that the config.json file location exists and is writable.

Related Guides

More Netlify Tutorials

Other Tool Tutorials

Ready to get started with Netlify?

Put this tutorial into practice. Visit Netlify and follow the steps above.

Visit Netlify