How to install Netlify CLI on Netlify

beginner 8 min read Updated 2026-03-13
Quick Answer

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

Prerequisites

  • Node.js version 18.14.0 or later
  • npm 8 or higher
  • Stable internet connection
  • Terminal or command line access
  • Netlify account

Step-by-Step Instructions

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.

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.

On macOS with Homebrew installed, you can alternatively run <code>brew install netlify-cli</code>.
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.

You can also run <code>netlify help</code> 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.

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.

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.

Alternatively, use <code>netlify clone</code> 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.

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.

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

Common Issues & Troubleshooting

ERR_MODULE_NOT_FOUND error during installation on Node 20.x

Update Netlify CLI to version 19.1.3 or later with <code>npm install -g netlify-cli@latest</code>. Clear your npm cache with <code>npm cache clean --force</code> and reinstall. This issue was fixed in v19.1.3.

Sharp dependency build failures or timeout errors on Linux

Install required build tools with <code>sudo apt install build-essential python3</code> 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 <code>npm install netlify-cli -g --no-optional</code> to skip optional dependencies, or use nvm to switch to a different Node.js version.

netlify command not found after installation

Verify installation with <code>npm list -g netlify-cli</code>. Check that npm's global prefix is in your system PATH. On macOS/Linux, run <code>echo $PATH</code> 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 <code>npm cache clean --force</code> and running <code>netlify login</code> again. Check that the config.json file location exists and is writable.