gatsby command not found

Created on 16 Sep 2017  ·  20Comments  ·  Source: gatsbyjs/gatsby

node @8.2.1
[email protected]

Following the official guide I run:
npm install --global gatsby-cli

Then when running:
gatsby new tutorial-part-one https://github.com/gatsbyjs/gatsby-starter-hello-world

gatsby: command not found

When looking at the globally installed npm packages I get:
screen shot 2017-09-16 at 13 28 10

stale? question or discussion

Most helpful comment

On the latest MacOS, I had to update my npm config.

npm config delete prefix
npm config set prefix /usr/local
npm i -g gatsby-cli
gatsby --version

All 20 comments

Try uninstalling and reinstalling the global package. Probably just an install error.

I've tried installing and reinstalling but I get the same error. (Also the same red error when listing the global packages).

Any other direction you can point me to?

Try Yarn

The same result )-:

Looking into this now:
https://github.com/yarnpkg/yarn/issues/2064

If I lookup "Gatsby" in this thread, the same issue is mentioned.

You can search where npm install global packages and check if it is in your
path.

On Sep 16, 2017 2:38 PM, "yaron" notifications@github.com wrote:

Looking into this now:
yarnpkg/yarn#2064 https://github.com/yarnpkg/yarn/issues/2064

If I lookup "Gatsby" in this thread, the same issue is mentioned.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/gatsbyjs/gatsby/issues/2137#issuecomment-329966000,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AH_TYc6v1tn8t4YAm8ktDIbBG9xr-m9Bks5si8EogaJpZM4PZx5j
.

Yarn sure solved the problem for me on Ubuntu
sudo yarn global add gatsby-cli

Problem may be you switch your node version using nvm, and package is installed under ~/.nvm/versions/node/{version}/lib, so run gatsby will throw error.

not sure why but @Oluwasetemi your sudo command worked for me

I had the issue after installing Gatsby globally several times on a mac (OS 10.13.2). I tried different node & npm versions. It turned out that the node/npm installs were not in the standard /usr/local/lib/ folder. I reinstalled both from https://nodejs.org/en/download/ making sure the location was correct and then cd to that location before installing Gatsby. Gatsby commands worked perfectly after that.

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub issues, we have to clean some of the old issues as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Gatsby version and check if that solves the issue. Let us know if that works for you by adding a comment 👍

This issue is being closed because there hasn't been any activity for at least 30 days. Feel free to open a new one if you still experience this problem 👍

On the latest MacOS, I had to update my npm config.

npm config delete prefix
npm config set prefix /usr/local
npm i -g gatsby-cli
gatsby --version

None of the above work for me. I had to follow this StackOverflow: https://stackoverflow.com/questions/42285518/sh-sysctl-command-not-found-for-mac-os-x-running-a-cron-job But actually, I had to add /usr/sbin to my PATH on Mac. Wasn't finding sysctl on my path. Maybe a Gatsby v2 thing, didn't happen before on same Mac.

On the latest MacOS, I had to update my npm config.

npm config delete prefix
npm config set prefix /usr/local
npm i -g gatsby-cli
gatsby --version

This worked for me

thank you very much

On the latest MacOS, I had to update my npm config.

npm config delete prefix
npm config set prefix /usr/local
npm i -g gatsby-cli
gatsby --version

Thank you so much! It works!

On the latest MacOS, I had to update my npm config.

npm config delete prefix
npm config set prefix /usr/local
npm i -g gatsby-cli
gatsby --version

I had the problem above...now by following this command it works also for me...

I ran into this issue when installing (2.7.47) via npm on mac os.
Managing node with nvm... not sure if relevant!

The fix for me (@Oluwasetemi solution):

  1. sudo npm uninstall -g gatsby-cli
  2. sudo yarn global add gatsby-cli

On the latest MacOS, I had to update my npm config.

npm config delete prefix
npm config set prefix /usr/local
npm i -g gatsby-cli
gatsby --version

This solution solved my problems, thank you.

npm install -g gatsby-cli to install globally

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andykais picture andykais  ·  3Comments

KyleAMathews picture KyleAMathews  ·  3Comments

dustinhorton picture dustinhorton  ·  3Comments

kalinchernev picture kalinchernev  ·  3Comments

theduke picture theduke  ·  3Comments