Hi, I've just updated Gatsby to the latest version, 1.5.0. I'm using the gatsby-source-contentful plugin which is working fine. All the content gets pull in and pages are generated.
Then the server starts up and complains about react-router-scroll missing
ERROR Failed to compile with 1 errors 7:03:01 PM
This dependency was not found:
* react-router-scroll in ./.cache/root.js
To install it, you can run: npm install --save react-router-scroll
After installing react-router-scroll I get the following warnings and then errors.
npm WARN [email protected] requires a peer of webpack@^2.0.0 || >= 3.0.0-rc.0 || ^3.0.0 but none was installed.
npm WARN [email protected] requires a peer of history@^2.0.0 || ^3.0.0 but none was installed.
```
This dependency was not found:
To install it, you can run: npm install --save history/lib/DOMStateStorage
This looks to do with the current version of `history` being used. I think found this issue reported earlier here https://github.com/taion/react-router-scroll/issues/51.
So I tried downgrading `history` to `^3.0.0` which then resulted in different missing dependencies. After going round and round in circles I'm at a complete loss! Has anyone encountered this before?
My `package.json` is as follows.
```{
"version": "1.0.0",
"dependencies": {
"classnames": "^2.2.5",
"css-loader": "^0.28.4",
"gatsby": "latest",
"gatsby-link": "latest",
"gatsby-plugin-google-analytics": "latest",
"gatsby-plugin-offline": "latest",
"gatsby-source-contentful": "latest",
"gatsby-transformer-remark": "latest",
"lodash": "4.17.2",
"moment": "2.18.1",
"node-sass": "^4.5.3",
"react-redux": "5.0.5",
"react-router": "^3.0.0",
"react-router-scroll": "^0.4.2",
"react-typekit": "^1.1.0",
"sass-loader": "^6.0.6",
"slash": "^1.0.0",
"style-loader": "^0.18.2",
"underscore.string": "^3.2.3"
},
"license": "ISC",
"main": "n/a",
"scripts": {
"dev": "gatsby develop",
"lint": "./node_modules/.bin/eslint --ext .js,.jsx --ignore-pattern public .",
"test": "echo \"No test specified\" && exit 0",
"build": "gatsby build",
"deploy": "gatsby build --prefix-links && push-dir --dir=build --branch=staging"
}
}
Many thanks in advanced, Harry.
Gatsby uses a fork of react-router-scroll. It sounds like upgrading messed up your node_modules somehow. Remove the new react-router-scroll dependency you added, delete node_modules, and reinstall and you should be fine.
I've lost count of how many times I've deleted my node_modules and tried what you suggested. In the end I had to copy react-router-scroll from the Contentful example project and get it working that way. So it's still an issue.
Solution seems to be installing ytase/react-router-scroll#build instead of react-router-scroll
Can you reproduce your problem on any of the example sites?
Most helpful comment
Solution seems to be installing
ytase/react-router-scroll#buildinstead ofreact-router-scroll