Skip to content

TypeError: Cannot read property 'getState' of undefined #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dwebfan opened this issue May 20, 2021 · 0 comments
Open

TypeError: Cannot read property 'getState' of undefined #43

dwebfan opened this issue May 20, 2021 · 0 comments

Comments

@dwebfan
Copy link

dwebfan commented May 20, 2021

I'm trying to use this project as bootstrap, but seems like some packages are outdated.

$ npm outdated
Package                  Current   Wanted  Latest  Location
@material-ui/core        MISSING   4.11.4  4.11.4  lomo-home
@material-ui/icons       MISSING   4.11.2  4.11.2  lomo-home
@material-ui/styles      MISSING   4.11.4  4.11.4  lomo-home
compression              MISSING    1.7.4   1.7.4  lomo-home
express                  MISSING   4.17.1  4.17.1  lomo-home
immer                    MISSING    8.0.4   9.0.2  lomo-home
next                     MISSING    9.5.5  10.2.1  lomo-home
next-redux-wrapper       MISSING    6.0.2   6.0.2  lomo-home
react                    MISSING  16.14.0  17.0.2  lomo-home
react-dom                MISSING  16.14.0  17.0.2  lomo-home
react-redux              MISSING    7.2.4   7.2.4  lomo-home
redux                    MISSING    4.1.0   4.1.0  lomo-home
redux-saga               MISSING    1.1.3   1.1.3  lomo-home
typescript-fsa           MISSING    3.0.0   3.0.0  lomo-home
typescript-fsa-reducers  MISSING    1.2.2   1.2.2  lomo-home

I try to upgrade to the latest one, but npm run dev got this failure. Can you please help?

wait  - compiling...
event - compiled successfully
/!\ You are using legacy implementaion. Please update your code: use createWrapper() and wrapper.withRedux().
Unexpected keys "AppTree", "Component", "router", "ctx" found in preloadedState argument passed to createStore. Expected to find one of the known reducer keys instead: "counter", "page", "reduxSagaDebounce", "reduxSagaThrottle". Unexpected keys will be ignored.
Index returned an empty object from `getInitialProps`. This de-optimizes and prevents automatic static optimization. https://nextjs.org/docs/messages/empty-object-getInitialProps
event - build page: /_error
wait  - compiling...
event - compiled successfully
/!\ You are using legacy implementaion. Please update your code: use createWrapper() and wrapper.withRedux().
TypeError: Cannot read property 'getState' of undefined
    at Function._defineProperty [as getInitialProps] (webpack-internal:///./pages/_document.tsx:118:31)
TypeError: Cannot read property 'getState' of undefined
    at /Users/qiwa/workspace/golang/src/github.com/deviceplane/lomohome/node_modules/react-redux/lib/components/Provider.js:33:18
    at Object.useMemo (/Users/qiwa/workspace/golang/src/github.com/deviceplane/lomohome/node_modules/react-dom/cjs/react-dom-server.node.development.js:1582:19)
    at useMemo (/Users/qiwa/workspace/golang/src/github.com/deviceplane/lomohome/node_modules/react/cjs/react.development.js:1532:21)
    at Provider (/Users/qiwa/workspace/golang/src/github.com/deviceplane/lomohome/node_modules/react-redux/lib/components/Provider.js:32:42)
    at processChild (/Users/qiwa/workspace/golang/src/github.com/deviceplane/lomohome/node_modules/react-dom/cjs/react-dom-server.node.development.js:3353:14)
    at resolve (/Users/qiwa/workspace/golang/src/github.com/deviceplane/lomohome/node_modules/react-dom/cjs/react-dom-server.node.development.js:3270:5)
    at ReactDOMServerRenderer.render (/Users/qiwa/workspace/golang/src/github.com/deviceplane/lomohome/node_modules/react-dom/cjs/react-dom-server.node.development.js:3753:22)
    at ReactDOMServerRenderer.read (/Users/qiwa/workspace/golang/src/github.com/deviceplane/lomohome/node_modules/react-dom/cjs/react-dom-server.node.development.js:3690:29)
    at renderToString (/Users/qiwa/workspace/golang/src/github.com/deviceplane/lomohome/node_modules/react-dom/cjs/react-dom-server.node.development.js:4298:27)
    at renderPage (/Users/qiwa/workspace/golang/src/github.com/deviceplane/lomohome/node_modules/next/dist/next-server/server/render.js:54:854)
    at Object.ctx.renderPage (webpack-internal:///./pages/_document.tsx:109:26)
    at Function.getInitialProps (webpack-internal:///./node_modules/next/dist/pages/_document.js:211:19)
    at Function._defineProperty [as getInitialProps] (webpack-internal:///./pages/_document.tsx:117:83)
    at loadGetInitialProps (/Users/qiwa/workspace/golang/src/github.com/deviceplane/lomohome/node_modules/next/dist/next-server/lib/utils.js:5:101)
    at renderToHTML (/Users/qiwa/workspace/golang/src/github.com/deviceplane/lomohome/node_modules/next/dist/next-server/server/render.js:54:1145)
    at processTicksAndRejections (internal/process/task_queues.js:86:5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant