zsh: command not found: netlify on mac OS

Viewed 2048

I am trying to deploy basic react-app to netlify. I ran these commands to install and deploy application

  • npm install netlify-cli -g
  • netlify deploy

It throws: zsh: command not found: netlify error.

I am working on mac OS. What is causing this issue?

4 Answers

It basically means your zshrc does not have npm binary directory in the PATH. Make sure that you have that squared away.

Are you using brew or nvm to install npm?

Correction

You have to install netlify-cli as well. That gives you the netlify command.

npm install -g netlify-cli

Go to folder:

/Users/<user>/.npm-global/lib/node_modules/

And delete any files/folders pertaining to Netlify. For exmaple folder named:

netlify-cli

Then reinstall the cli using

npm install netlify-cli -g

try this:

step 1: re-run the netlify-cli installation command to get the path where cli is installed

step 2: test the version using the full path where the cli is installed, it'll confirm that netlify-cli is working

step 3: add the npm directory link to your zsh environment variable PATH

  • Use the main Terminal(not the integrated terminal of your text editor) when installing the netlify-cli.

    npm install -g netlify-cli

I had installed it multiple times in the integrated terminal of VS code but all in vain.Success came after using the Terminal.

Related