'zsh: command not found: netlify on mac OS

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?



Solution 1:[1]

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

Solution 2:[2]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 758Gianni
Solution 2 miraj