无法读取NextJS服务器中未定义的属性'indexOf'

My Next JS website was working perfectly, one day when I tried to install Apollo Rest from here https://www.apollographql.com/docs/link/links/rest/#gatsby-focus-wrapper I began having a lot of errors. I discard any changes in packages.json, removed packages-lock.json, node_modules and dust file and folders. But keep getting the next error:

GraphQL error occurred [getDataFromTree] TypeError: Cannot read property 'indexOf' of undefined
    at addBasePath (F:\Projects\breadcrumps\showcase\dist\functions\next\server\static\development\pages\index.js:2966:15)
    at F:\Projects\breadcrumps\showcase\dist\functions\next\server\static\development\pages\index.js:2464:40
    at Link.formatUrls (F:\Projects\breadcrumps\showcase\dist\functions\next\server\static\development\pages\index.js:2388:18)
    at Link.render (F:\Projects\breadcrumps\showcase\dist\functions\next\server\static\development\pages\index.js:2588:14)
    at processChild (F:\Projects\breadcrumps\showcase\node_modules\react-dom\cjs\react-dom-server.node.development.js:3134:18)
    at resolve (F:\Projects\breadcrumps\showcase\node_modules\react-dom\cjs\react-dom-server.node.development.js:2960:5)
    at ReactDOMServerRenderer.render (F:\Projects\breadcrumps\showcase\node_modules\react-dom\cjs\react-dom-server.node.development.js:3435:22)
    at ReactDOMServerRenderer.read (F:\Projects\breadcrumps\showcase\node_modules\react-dom\cjs\react-dom-server.node.development.js:3373:29)
    at renderToStaticMarkup (F:\Projects\breadcrumps\showcase\node_modules\react-dom\cjs\react-dom-server.node.development.js:4004:27)
    at process (F:\Projects\breadcrumps\showcase\node_modules\@apollo\react-ssr\lib\react-ssr.cjs.js:38:16)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
TypeError: Cannot read property 'indexOf' of undefined
    at addBasePath (F:\Projects\breadcrumps\showcase\dist\functions\next\server\static\development\pages\index.js:2966:15)
    at F:\Projects\breadcrumps\showcase\dist\functions\next\server\static\development\pages\index.js:2464:40
    at Link.formatUrls (F:\Projects\breadcrumps\showcase\dist\functions\next\server\static\development\pages\index.js:2388:18)
    at Link.render (F:\Projects\breadcrumps\showcase\dist\functions\next\server\static\development\pages\index.js:2588:14)
    at processChild (F:\Projects\breadcrumps\showcase\node_modules\react-dom\cjs\react-dom-server.node.development.js:3134:18)
    at resolve (F:\Projects\breadcrumps\showcase\node_modules\react-dom\cjs\react-dom-server.node.development.js:2960:5)
    at ReactDOMServerRenderer.render (F:\Projects\breadcrumps\showcase\node_modules\react-dom\cjs\react-dom-server.node.development.js:3435:22)
    at ReactDOMServerRenderer.read (F:\Projects\breadcrumps\showcase\node_modules\react-dom\cjs\react-dom-server.node.development.js:3373:29)
    at renderToString (F:\Projects\breadcrumps\showcase\node_modules\react-dom\cjs\react-dom-server.node.development.js:3988:27)
    at render (F:\Projects\breadcrumps\showcase\node_modules\next\dist\next-server\server\render.js:83:16)
    at renderPage (F:\Projects\breadcrumps\showcase\node_modules\next\dist\next-server\server\render.js:415:16)
    at Object.ctx.renderPage (F:\Projects\breadcrumps\showcase\dist\functions\next\server\static\development\pages\_document.js:905:30)
    at Function.getInitialProps (F:\Projects\breadcrumps\showcase\dist\functions\next\server\static\development\pages\_document.js:247:19)
    at Function.getInitialProps (F:\Projects\breadcrumps\showcase\dist\functions\next\server\static\development\pages\_document.js:916:85)
    at Object.loadGetInitialProps (F:\Projects\breadcrumps\showcase\node_modules\next\dist\next-server\lib\utils.js:59:29)
    at Object.renderToHTML (F:\Projects\breadcrumps\showcase\node_modules\next\dist\next-server\server\render.js:419:36)
Error: "CustomDocument.getInitialProps()" should resolve to an object. But found "undefined" instead.
    at Object.loadGetInitialProps (F:\Projects\breadcrumps\showcase\node_modules\next\dist\next-server\lib\utils.js:65:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Object.renderToHTML (F:\Projects\breadcrumps\showcase\node_modules\next\dist\next-server\server\render.js:419:22)
    at async DevServer.renderToHTMLWithComponents (F:\Projects\breadcrumps\showcase\node_modules\next\dist\next-server\server\next-server.js:654:26)
    at async DevServer.renderToHTML (F:\Projects\breadcrumps\showcase\node_modules\next\dist\next-server\server\next-server.js:801:28)
    at async DevServer.renderToHTML (F:\Projects\breadcrumps\showcase\node_modules\next\dist\server\next-dev-server.js:22:539)
    at async DevServer.render (F:\Projects\breadcrumps\showcase\node_modules\next\dist\next-server\server\next-server.js:546:22)
    at async Object.fn (F:\Projects\breadcrumps\showcase\node_modules\next\dist\next-server\server\next-server.js:396:17)
    at async Router.execute (F:\Projects\breadcrumps\showcase\node_modules\next\dist\next-server\server\router.js:134:32)
    at async DevServer.run (F:\Projects\breadcrumps\showcase\node_modules\next\dist\next-server\server\next-server.js:511:29)
    at async DevServer.handleRequest (F:\Projects\breadcrumps\showcase\node_modules\next\dist\next-server\server\next-server.js:147:20)

任何解决这个烦人问题的提示,我将不胜感激。

评论