Add documentation to use npx
to get started with Gatsby
npx gatsby new gatsby-site https://github.com/gatsbyjs/gatsby-starter-default
This way you don't have to install the CLI globally which also keeps the CLI always up to date. Also Facebooks create-react-app
switched to it
@marcobiedermann a downside for this would be that users won't be able to use gatsby develop
, gatsby build
or gatsby serve
directly.
Users will need to have scripts do that in package.json. What do you think about that?
@kakadiadarpan
Are you sure about this?
I don't have gatsby-cli
installed on my machine and it does work for me like a charm.
npx gatsby new gatsby-site https://github.com/gatsbyjs/gatsby-starter-default
npm run develop
I also run npm uninstall -g gatsby-cli
to double check.
Yes you are right that you are no longer able to run gatsby develop
straight from the command line but I don't see any need for that. You should always use npm package scripts to run third party tools.
Some context on why we currently don't use npx
in docs: Gatsby atm supports Node 6, which by default comes with npm version that doesn't have npx
support - and our docs need to have instructions that will work on every supported Node version. We will probably be dropping Node 6 support in next major Gatsby release and then we will be able to convert docs to use npx
(and async/await
in code examples)
Personally, I'm not a fan of globally installing npm packages.
If gatsby-cli
was installed as a dev-dependency, then yarn develop
or npm run develop
will work fine, since yarn
/npm
will know to use the locally-installed gatsby-cli
package.
See:
I do understand both parties here. We (gatsby team) don't want to make it more complex for beginners but I think it's still a good idea to show the npx option as an alternative installation as most users are on node 8 or have npx installed on node 6.
I'll think about how to make a subtle PR for this so we add npx as a sidenote.
We can also create some packages to support yarn create
For now i'll make this item as blocked because we are waiting for Node 8
The github repo for the default starter says to use npx gatsby new ...
but then it says to run gatsby develop
. If the the cli is not globally installed that failes as pointed out by @kakadiadarpan
isn't npx gatsby develop
same as doing npm run develop
or yarn develop
?
Hiya!
This issue has gone quiet. Spooky quiet. 馃懟
We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
Thanks for being a part of the Gatsby community! 馃挭馃挏
Hey again!
It鈥檚 been 30 days since anything happened on this issue, so our friendly neighborhood robot (that鈥檚 me!) is going to close it.
Please keep in mind that I鈥檓 only a robot, so if I鈥檝e closed this issue in error, I鈥檓 HUMAN_EMOTION_SORRY
. Please feel free to reopen this issue or create a new one if you need anything else.
Thanks again for being part of the Gatsby community!
Has there been any update on this?
it still seems relevant...
Any update on this? It's still relevant...
npx would be sweet. just sayin'
Most helpful comment
@kakadiadarpan
Are you sure about this?
I don't have
gatsby-cli
installed on my machine and it does work for me like a charm.I also run
npm uninstall -g gatsby-cli
to double check.Yes you are right that you are no longer able to run
gatsby develop
straight from the command line but I don't see any need for that. You should always use npm package scripts to run third party tools.