Error running npx create-strapi-starter my-project gatsby-blog

Viewed 265

I was following Strapi's Quick Start Guide where you can use a starter to create a project with Gatsby by running:

npx create-strapi-starter my-project gatsby-blog

The backend part installed all dependencies, but the frontend part failed with this message:

Error: Command failed with exit code 1: npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: gatsby-starter-default@0.1.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"^17.0.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^15.0.0 || ^16.0.0" from react-markdown@4.3.1
npm ERR! node_modules/react-markdown
npm ERR!   react-markdown@"^4.3.1" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/ronald/.npm/eresolve-report.txt for a full report.

I'm using a Mac with Node v14.17.1 and NPM 7.24.0

1 Answers

I think you need to install the peer dependencies due some mismatching between versions.

For example, React needs to be between ^15.0.0 and ^16.0.0 and found a 17.0.2:

npm ERR! Found: react@17.0.2

Try downgrading each version to the corresponding one or just run the command using the --legacy-peer-deps flag. On the root of the front-end project just run:

npm install --legacy-peer-deps

You can even try it with the original command:

npx create-strapi-starter my-project gatsby-blog
Related