Netlify and Oh-my-Zsh, not such good friends

Have you ever tried to deploy with Netlify from using the CLI tool with a Oh-my-Zsh terminal? It’s not so fun.

So you’ve finish your project, you’re all set to go, you’ve run your build, you’ve set up all the requirement and all you want to is publish to the Netlify.

You:

npm install netlify-cli -gnpm run build

Everything looks good, and you

npx netlify deploy

Then tragedy strikes.

zsh: command not found

What the h? I just install netlify-cli, what is going on? Well like I said, Netlify and zsh, not such good friend. So what do you have to in order to make these two play nice?

First, just make sure you npm i is valid, make sure your dependencies are all good.

Second, try

npx netlify deploy

If you don’t get your nice fluffy message that everything is working, then we:

./build
npx netlify deploy --prod

If not, go the the last option.

We are going to have to fix that issue you’re zsh is having with the $PATH variable. The fast way to do this is to go back into your terminal, under the binaries directory to the path. You can do this by entering the follow:

export PATH=/User/<yourusername>/.npm-global/bin:$PATH

You should be able to complete your Netlify build now:

npx netlify deploy ./buildnetlify deploy --prod 

Now you get the beautiful success message! What beautiful thing.

The only problem? export PATH, that is a temporary fix. To permanently add this, you have to edit ~/.zschrc

On a mac, you will need to use nano : nano ~/.zshrc

Then add your export PATH.

Hope you all find this helpful and don’t run into this issue!

Sources:

https://github.com/netlify/cli/issues/696

A Full Stack Developer passionate about learning. I love puzzles, problem solving & hang out with my dog. https://highermay.dev/