Skip to content

Commit

Permalink
fix(create-gatsby): Use legacy peer deps (#29856) (#29862)
Browse files Browse the repository at this point in the history
* fix(create-gatsby): Use legacy peer deps

* Update tests

(cherry picked from commit a92b276)

Co-authored-by: Matt Kane <matt@gatsbyjs.com>
  • Loading branch information
GatsbyJS Bot and ascorbic committed Mar 1, 2021
1 parent fdc1fe2 commit 8639f7b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 9 additions & 1 deletion packages/create-gatsby/src/__tests__/init-starter.ts
Expand Up @@ -153,7 +153,15 @@ describe(`init-starter`, () => {
)
expect(execa).toBeCalledWith(
`npm`,
[`install`, `--loglevel`, `error`, `--color`, `always`, `one-package`],
[
`install`,
`--loglevel`,
`error`,
`--color`,
`always`,
`--legacy-peer-deps`,
`one-package`,
],
{ stderr: `inherit` }
)
})
Expand Down
8 changes: 6 additions & 2 deletions packages/create-gatsby/src/init-starter.ts
Expand Up @@ -99,7 +99,7 @@ const setNameInPackage = async (
delete packageJson.author
}

await fs.writeJSON(packageJsonPath, packageJson)
await fs.writeJSON(packageJsonPath, packageJson, { spaces: 2 })
}

// Executes `npm install` or `yarn install` in rootPath.
Expand Down Expand Up @@ -139,7 +139,11 @@ const install = async (
reporter.success(`Installed Gatsby`)
reporter.info(`${c.blueBright(c.symbols.pointer)} Installing plugins...`)

await execa(`npm`, [`install`, ...config, ...packages], options)
await execa(
`npm`,
[`install`, ...config, `--legacy-peer-deps`, ...packages],
options
)
await clearLine()
}

Expand Down

0 comments on commit 8639f7b

Please sign in to comment.