gatsbyjs / gatsby-starter-wordpress-blog

BSD Zero Clause License
103 stars 130 forks source link

New project fails to npm install #19

Open Asgaroth opened 3 years ago

Asgaroth commented 3 years ago

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: react@17.0.2
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 gatsby@4.0.2
npm ERR!   node_modules/gatsby
npm ERR!     gatsby@"^4.0.0" from the root project
npm ERR!     peer gatsby@"^4.0.0-next" from gatsby-plugin-image@2.0.0
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 react-side-effect@1.2.0
npm ERR! node_modules/react-helmet/node_modules/react-side-effect
npm ERR!   react-side-effect@"^1.1.0" from react-helmet@5.2.1
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! 
hansdb commented 3 years ago

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.

bzx commented 3 years ago

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?

tekindermisel commented 2 years ago

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.

peiche commented 2 years ago

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.