Gatsby: Having issues running `gatsby` command after installing globally

Created on 30 Jun 2017  ·  9Comments  ·  Source: gatsbyjs/gatsby

gatsby version: 1.0.0-beta.5
node version: v8.0.0
OS version: macOS Sierra v10.12.5

This may very well be an issue not related to gatsby. I'm still fairly new to npm and installing global and local packages so this could be something unique to me.

The problem I seem to be having is that, when I install gatsby globally using the command npm install -g gatsby@next and then attempt to initialize a new project with gatsby new <project name>, I receive this response:

bin/gatsby: time since started: 0.085
A local install of Gatsby was not found.
You should save Gatsby as a site dependency e.g. npm install --save gatsby

If I list my global npm packages using npm list -g --depth=0, I see that gatsby has indeed installed globally. I don't really understand where I've gone wrong.

What's more strange is that before this issue I ran npm install -g gatsby (notice the missing @next suffix) and was able to initialize a project just fine. Then after reading the docs on www.gatsbyjs.org/docs/, I uninstalled and reinstalled gatsby@next (not sure why I uninstalled instead of just upgrading. still new here :) ).

Any insights as to why this could be happening would be greatly appreciated! 👍

Most helpful comment

Hey @KyleAMathews , I just installed [email protected] via npm i -g gatsby@next and am still receiving the same error as originally reported:

screen shot 2017-07-04 at 7 09 53 pm

I noticed something interesting that may help with the debugging process:

If I install gatsby via npm i -g gatsby@next as I have been, and then list out my global npm packaes via npm list -g --depth=0 ( note that the image below shows the command list-npm-globals. Just an alias :) ), I get a few npm errors. If I then _remove_ the global gatsby package and then run npm list -g --depth=0, the errors are gone:

screen shot 2017-07-04 at 7 16 23 pm

Until this issue is resolved, I'll continue to use gatsby@latest. Thanks!

All 9 comments

Perhaps you weren't running Gatsby inside the directory the gatsby new command created?

I've got the same issue as @jake-wies (I'm also new here 😃).

Gatsby version: 1.0.0-beta.5
node.js version: v7.7.2 (also happens on v8.1.0)
OS version: macOS Sierra 10.12.5

➜ npm install -g gatsby@next
➜ gatsby new test gatsbyjs/gatsby-starter-blog#1.0
bin/gatsby: time since started: 0.087
A local install of Gatsby was not found.
You should save Gatsby as a site dependency e.g. npm install --save gatsby

+1 identical problem as described by the others

patrick-MS-7345%
 gatsby new taskmgr
A local install of Gatsby was not found.
You should save Gatsby as a site dependency e.g. npm install --save gatsby

Try installing gatsby@latest instead of next. I'll look into this soon.

On Sun, Jul 2, 2017, 7:08 PM pnloyd notifications@github.com wrote:

+1 identical problem as described by the others

patrick-MS-7345% gatsby new taskmgr A local install of Gatsby was not
found. You should save Gatsby as a site dependency e.g. npm install --save
gatsby


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/gatsbyjs/gatsby/issues/1306#issuecomment-312533829,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEVhyygEzFaVRPrBbknLi1Wje6jmcs0ks5sKE0pgaJpZM4OKGvt
.

@KyleAMathews I installed gatsby globally. So I don't think would be an issue unless I'm completely misunderstanding the way global npm modules work. I'll go ahead and install gatsby@latest and see what results that brings. Thanks for all the help!

There's a bit of confusion right now in that Gatsby the global CLI and
Gatsby the core package for building sites are the same thing. I intend to
split out the CLI into its own package soon but not right now. It sounds
like Gatsby v1 as a CLI aka the global install is buggy which is why I
suggest installing v0.12 to run gatsby new.

On Sun, Jul 2, 2017, 7:18 PM Jake Wiesler notifications@github.com wrote:

@KyleAMathews https://github.com/kyleamathews I installed gatsby
globally. So I don't think would be an issue unless I'm completely
misunderstanding the way global npm modules work. I'll go ahead and
install gatsby@latest and see what results that brings. Thanks for all
the help!


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/gatsbyjs/gatsby/issues/1306#issuecomment-312534767,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEVh1Je-UkhJCLNUndzcXo_FR958LRjks5sKE9mgaJpZM4OKGvt
.

gatsby@latest is working just fine.
Kyle I definitely think splitting them is the right choice! I was confused by that at first.

Just published 1.0.[email protected] which should solve this issue. Thanks for the reports (and patience).

Hey @KyleAMathews , I just installed [email protected] via npm i -g gatsby@next and am still receiving the same error as originally reported:

screen shot 2017-07-04 at 7 09 53 pm

I noticed something interesting that may help with the debugging process:

If I install gatsby via npm i -g gatsby@next as I have been, and then list out my global npm packaes via npm list -g --depth=0 ( note that the image below shows the command list-npm-globals. Just an alias :) ), I get a few npm errors. If I then _remove_ the global gatsby package and then run npm list -g --depth=0, the errors are gone:

screen shot 2017-07-04 at 7 16 23 pm

Until this issue is resolved, I'll continue to use gatsby@latest. Thanks!

Was this page helpful?
0 / 5 - 0 ratings