Skip to content

Commit

Permalink
add section on how to change default package manager. (#19098)
Browse files Browse the repository at this point in the history
* add section on how to change default package manager.

Changing the default package manager used by `gatsby-cli`can be tricky for newcomers as there is no CLI command for this. I've added some explanation to help those who want to change it by modifying the configstore file.

* be more explicit on the purpose of this change

This default package manager change only concerns future projects using gatsby new.

* prettier ok

* Update docs/docs/gatsby-cli.md

Co-Authored-By: Marcy Sutton <marcy@gatsbyjs.com>
  • Loading branch information
dantereve and Marcy Sutton committed Oct 29, 2019
1 parent d472a43 commit 719c56d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/docs/gatsby-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,30 @@ For more information, check out the [Gatsby REPL documentation](/docs/gatsby-rep
### Disabling colored output

In addition to the explicit `--no-color` option, the CLI respects the presence of the `NO_COLOR` environment variable (see [no-color.org](https://no-color.org/)).

## How to change your default package manager for your next project?

When you use `gatsby new` for the first time to create a new project, you are asked to choose your default package manager between yarn and npm.

```shell
Which package manager would you like to use ? › - Use arrow-keys. Return to submit.
❯ yarn
npm
```

Once you’ve made your choice, the CLI won’t ask for your preference again for any subsequent project.

If you want to change this for your next project you have to edit the config file created automatically by the CLI.
This file is available on your system at: `~/.config/gatsby/config.json`

In it you’re going to see something like this.

```json:title=config.json
{
"cli": {
"packageManager": "yarn"
}
}
```

Edit your `packageManager` value, save and you’re good to go for your next project using `gatsby new`.

0 comments on commit 719c56d

Please sign in to comment.