gatsby-starter-wordpress-blog icon indicating copy to clipboard operation
gatsby-starter-wordpress-blog copied to clipboard

New project fails to npm install

Open Asgaroth opened this issue 3 years ago • 4 comments

I was just following the instructions at

gatsby new some-blog https://github.com/gatsbyjs/gatsby-starter-wordpress-blog

But npm fails to install with

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"^17.0.1" from the root project
npm ERR!   peer react@"^16.9.0 || ^17.0.0" from [email protected]
npm ERR!   node_modules/gatsby
npm ERR!     gatsby@"^4.0.0" from the root project
npm ERR!     peer gatsby@"^4.0.0-next" from [email protected]
npm ERR!     node_modules/gatsby-plugin-image
npm ERR!       gatsby-plugin-image@"^2.0.0" from the root project
npm ERR!       1 more (gatsby-source-wordpress)
npm ERR!     11 more (gatsby-plugin-sharp, gatsby-source-filesystem, ...)
npm ERR!   8 more (react-dom, gatsby-plugin-image, gatsby-plugin-offline, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^0.13.0 || ^0.14.0 || ^15.0.0 || ^16.0.0" from [email protected]
npm ERR! node_modules/react-helmet/node_modules/react-side-effect
npm ERR!   react-side-effect@"^1.1.0" from [email protected]
npm ERR!   node_modules/react-helmet
npm ERR!     react-helmet@"^5.2.1" from the root project
npm ERR!     1 more (gatsby-plugin-react-helmet)
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! 

Asgaroth avatar Oct 30 '21 22:10 Asgaroth

Changed react-helmet version from 5.2.1 to 6.1.0 (latest) in package.json fixes the npm install issue. Not sure if it is fully backwards compatible with v5.

hansdb avatar Nov 12 '21 09:11 hansdb

I have a similar problem – after following the guide there's a bunch of npm errors shown, and running gatsby develop gets stuck. Looks like this project is abandoned or something... I've tried different methods of adding gatsby-source-wordpress (from scratch, from a starter) and it all fails or gets stuck. How can this be advertised as "working" when it's not?

bzx avatar Nov 25 '21 21:11 bzx

hello @Asgaroth, in order to make it work you need to do two things, after you run that command:

  1. Go into directory "some-blog" and in the package.json reduce react and react-dom to 16.0.1
  2. Run npm install "npm i acorn --dev"

After that, check with "npm run start" or "yarn start" to spin up the local server.

tekindermisel avatar Dec 20 '21 10:12 tekindermisel

Alternatively, you can run npm install --legacy-peer-deps to leave the React versions as they are in this repo. That's what I did, and it installed everything successfully.

peiche avatar Feb 18 '22 23:02 peiche