Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gatsby command not found #2137

Closed
yaronlevi opened this issue Sep 16, 2017 · 21 comments
Closed

gatsby command not found #2137

yaronlevi opened this issue Sep 16, 2017 · 21 comments
Labels
stale? Issue that may be closed soon due to the original author not responding any more. type: question or discussion Issue discussing or asking a question about Gatsby

Comments

@yaronlevi
Copy link

node @8.2.1
npm@5.3.0

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

@KyleAMathews
Copy link
Contributor

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

@yaronlevi
Copy link
Author

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?

@KyleAMathews
Copy link
Contributor

Try Yarn

@yaronlevi
Copy link
Author

The same result )-:

@yaronlevi
Copy link
Author

Looking into this now:
yarnpkg/yarn#2064

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

@abumalick
Copy link
Contributor

abumalick commented Sep 19, 2017 via email

@Oluwasetemi
Copy link

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

@jasonxia23
Copy link

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.

@nodox
Copy link
Contributor

nodox commented Mar 6, 2018

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

@m1r9h71
Copy link

m1r9h71 commented Aug 23, 2018

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.

@kakadiadarpan kakadiadarpan added the type: question or discussion Issue discussing or asking a question about Gatsby label Sep 28, 2018
@kakadiadarpan
Copy link
Contributor

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 👍

@kakadiadarpan kakadiadarpan added the stale? Issue that may be closed soon due to the original author not responding any more. label Sep 28, 2018
@kakadiadarpan
Copy link
Contributor

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 👍

@RyanPWalker
Copy link

RyanPWalker commented Nov 27, 2018

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

@mccrodp
Copy link
Contributor

mccrodp commented Dec 6, 2018

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.

@YLD1
Copy link

YLD1 commented Mar 26, 2019

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

@kipps
Copy link

kipps commented Jul 12, 2019

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!

@Rosin355
Copy link

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...

@jstansbe
Copy link

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

@askiebaby
Copy link

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.

@life-efficient
Copy link

npm install -g gatsby-cli to install globally

@vishnupriyavr
Copy link

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

Thanks, this worked for me, however only npm works and yarn does not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale? Issue that may be closed soon due to the original author not responding any more. type: question or discussion Issue discussing or asking a question about Gatsby
Projects
None yet
Development

No branches or pull requests