Comments (19)
Try rm node_modules/react-router -fr && npm install
from mobx-react-router.
@JohnLouderback Yeah the react-router peer dependency should be enough to guarantee that history v3
is installed. Looks like history was upgraded to v4
somehow...
Either way glad it's working now!
from mobx-react-router.
No problem. So this package now requires react-router v3, which uses the new history
package version. I think history.getCurrentLocation
has been replaced by just history.location
- https://github.com/mjackson/history#usage
from mobx-react-router.
i was trying to change history.getCurrentLocation
to history.location()
in mobx-react-router.js:268
but got similar error TypeError: history.location is not a function(β¦)
maybe my react-router package is not 3.0.0. npm list
shows that i have +-- UNMET PEER DEPENDENCY [email protected]
cuz in my package.json there is "react-router": "^3.0.0", and i put npm update [email protected]
from mobx-react-router.
Just checking the code history.getCurrentLocation
will still work with v3. Yeah I think it's because you have react-router v2. I decided to only support v3 as there aren't really any major changes from v2, just bug fixes.
from mobx-react-router.
What version of this package have you got installed?
from mobx-react-router.
from mobx-react-router.
don't know how to update this UNMET PEER DEPENDENCY [email protected] cuz i did all standart npm update methods
from mobx-react-router.
i have used this rm node_modules/react-router -fr && npm install
and now npm list --depth=0 shows [email protected]. It seems that problem is solved. Need to fix few more bugs from refactoring code and i'll notify very soon
Any way thank u for ur support!
from mobx-react-router.
No problem good luck π
from mobx-react-router.
@alisd23 I'm having the same issue, however the steps above do not resolve the issue for me. I am seeing UNMET PEER DEPENDENCY [email protected]
despite that module being installed and in the package.json. I even deleted a fresh installed all my node modules.
from mobx-react-router.
This may be relevant remix-run/history#402
Also, this is what I see on my history
object:
from mobx-react-router.
@JohnLouderback Ah I didn't realise mobx released a new major version. This library still has a peer dependency on v2.5.2, so I wonder if that's the issue. I'll investigate.
from mobx-react-router.
Hmm History v3 definitely has getCurrentLocation
on it. And react-router depends on history v3, so are you definitely using react-router v3
?
from mobx-react-router.
npm list --depth=0
shows +-- [email protected]
When I set a break point at the method call in the mobx-react-router
module to getCurrentLocation
That's where (as seen in the screenshot above) the history object does not have that method defined on it. Perhaps its something with the way I have everything initialized. Here's the module where the history object is set up:
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Router, browserHistory } from 'react-router';
import getRoutes from './routes';
import { Provider } from 'mobx-react';
import { observable, extendObservable } from 'mobx'
import { RouterStore, syncHistoryWithStore } from 'mobx-react-router';
import ApiClient from './helpers/ApiClient';
const clone = (obj : Object) : Object => JSON.parse(JSON.stringify(obj))
const client = new ApiClient();
const routingStore = new RouterStore();
const stores = window['stores'] = observable({
...clone(window['__data']),
routes: routingStore
});
const history = syncHistoryWithStore(browserHistory, routingStore);
ReactDOM.render(
<Provider {...stores}>
<Router history={history}>
{getRoutes(stores)}
</Router>
</Provider>,
document.getElementById('content')
);
If there's anymore information I can provide you with to help troubleshoot the issue, let me know.
from mobx-react-router.
Ah, so when I run npm show history version
it outputs 4.5.1
. I wonder if the problem isn't that react-router is set up to install whatever the newest version is of the history module.
from mobx-react-router.
Okay, so that was in fact the issue. Running rm node_modules/history -fr && npm install [email protected]
fixed the issue. I would say, it would good if this package has a fall forward for the latest history
package.
from mobx-react-router.
@JohnLouderback Seems weird, react-router
v3 has its own dependency as history
^3.0.0
(see react-router/package.json#L36)
The module history
always have breaking changes in its major updates, so it's important to keep major version. Try to inspect if other dependencies install the latest version of the history module.
from mobx-react-router.
Thanks for the help!
from mobx-react-router.
Related Issues (20)
- Newly created store missing history and location in react-router 6.x HOT 31
- mobx-react-router/Router not exported HOT 1
- Doc with react-router-v6 is missing.
- Remove support for decorators
- New react-router typings causes mismatch with mobx-react-router HOT 3
- Nested routes HOT 2
- Any way to update a hash route? HOT 1
- .. with Typescript Property 'routing' does not exist on type 'Readonly<{ children?: ReactNode; }> & Readonly<{}> HOT 4
- How to get route params? HOT 4
- update peer dependencies HOT 1
- [question] this vs react-router-dom HOT 1
- n element descriptor's .kind property must be either βmethodβ or βfieldβ HOT 2
- Issue with TypeScript when trying to use SynchronizedHistory from RouterStore HOT 1
- How to send params to other pages? HOT 3
- Compatible with Server Side Rendering? HOT 2
- Update Peer Dependency HOT 3
- Server Side Rendering is broken in v4.0.6 HOT 1
- Pass state with RoutingStore.push() HOT 1
- Looking for maintainers HOT 11
- will v3 with latest mobx? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mobx-react-router.