NextJS throws random "Error: Cannot find module './undefined'" - next.js

I just encountered this error while navigating to different links using NextJs's Link Component; Once this error showed up, I couldn't access any pages until I restarted the npm run build command, and everything worked properly again.
However, I can't figure out what caused this error and I wanted to make sure this doesn't happen in my production app. Does anyone have an idea what might have caused this error?
Error: Cannot find module './undefined'
Require stack:
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/.next/server/webpack-runtime.js
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/.next/server/pages/_document.js
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/server/require.js
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/server/load-components.js
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/build/utils.js
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/build/output/store.js
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/build/output/index.js
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/cli/next-dev.js
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/bin/next
at Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at mod._resolveFilename (/Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/build/webpack/require-hook.js:183:28)
at Module._load (node:internal/modules/cjs/loader:804:27)
at Module.require (node:internal/modules/cjs/loader:1022:19)
at require (node:internal/modules/cjs/helpers:102:18)
at __webpack_require__.f.require (/Users/tylerkim/Documents/GitHub/scraft/scraft-app/.next/server/webpack-runtime.js:233:28)
at /Users/tylerkim/Documents/GitHub/scraft/scraft-app/.next/server/webpack-runtime.js:160:40
at Array.reduce (<anonymous>)
at __webpack_require__.e (/Users/tylerkim/Documents/GitHub/scraft/scraft-app/.next/server/webpack-runtime.js:159:67)
at Array.map (<anonymous>) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/.next/server/webpack-runtime.js',
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/.next/server/pages/_document.js',
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/server/require.js',
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/server/load-components.js',
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/build/utils.js',
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/build/output/store.js',
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/build/output/index.js',
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/cli/next-dev.js',
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/bin/next'
]
}
error - Error: Cannot find module './undefined'

You're trying to import a page called undefined in /pages/_document.js, which I imagine isn't what you really want to do.
Can you add your _document page import code?

Related

Symfony encore watch and vscode Remote SSH development freeze the server when running at the same time

I'm developing my Symfony project on a remote server and use Vscode Remore SSH plugin to writing code on it.
I use symfony Webpack Encore to build front side, and if I try to run commands like yarn encore dev or yarn watch to let webpack to rebuild my assets when vscode is working and connected to the server all freeze.
Web pages become loading very long time, vscode cannot save anything and the command line may show sting Running webpack ... without any results a minutes or throw an error like this
[webpack-cli] Failed to load '/var/proj/veto/webpack.config.js' config
[webpack-cli] Error: Timed out waiting for sync-rpc server to start (it should respond with "pong" when sent "ping"):
node:events:491
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED 127.0.0.1:36465
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 36465
}
at waitForAlive (/var/proj/veto/node_modules/sync-rpc/lib/index.js:85:11)
at start (/var/proj/veto/node_modules/sync-rpc/lib/index.js:41:3)
at sendMessage (/var/proj/veto/node_modules/sync-rpc/lib/index.js:133:17)
at createClient (/var/proj/veto/node_modules/sync-rpc/lib/index.js:173:27)
at Object.<anonymous> (/var/proj/veto/node_modules/#symfony/webpack-encore/lib/plugins/eslint.js:13:32)
at Module._compile (node:internal/modules/cjs/loader:1165:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1219:10)
at Module.load (node:internal/modules/cjs/loader:1043:32)
at Function.Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1067:19)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
When vscode doesn't work webpack's running without any problems. When I'm writing and saving code and do not use webpack all works great either.
I have very few ideas how can I fix it. How may it be related?
I tried to turn off vscode plugins that may scanning the project, but it didn't help

Scss error: ./src/routes/styles/home.scss -> Module build failed (from ./node_modules/resolve-url-loader/index.js):

Just added a scss file, I tried installing sass but that did not work. Have a feeling downgrading will work but I really dont want to considering all other packages are working with node 18.
The Full Error looks like:
Compiled with problems:
ERROR in ./src/routes/styles/home.scss (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[7].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[7].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[1].oneOf[7].use[3]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[7].use[4]!./src/routes/styles/home.scss)
Module build failed (from ./node_modules/resolve-url-loader/index.js):
Error: Cannot find module './lib/value-processor'
Require stack:
- /home/ed-tee/Documents/Code/profile2/node_modules/resolve-url-loader/index.js
- /home/ed-tee/Documents/Code/profile2/node_modules/loader-runner/lib/loadLoader.js
- /home/ed-tee/Documents/Code/profile2/node_modules/loader-runner/lib/LoaderRunner.js
- /home/ed-tee/Documents/Code/profile2/node_modules/webpack/lib/NormalModule.js
- /home/ed-tee/Documents/Code/profile2/node_modules/webpack-manifest-plugin/dist/index.js
- /home/ed-tee/Documents/Code/profile2/node_modules/react-scripts/config/webpack.config.js
- /home/ed-tee/Documents/Code/profile2/node_modules/react-scripts/scripts/start.js
at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
at Module._load (node:internal/modules/cjs/loader:841:27)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/home/ed-tee/Documents/Code/profile2/node_modules/resolve-url-loader/index.js:16:24)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1061:19)
I tried installing sass
Update:
I used resolve-url-loader and it worked,
link: https://www.npmjs.com/package/resolve-url-loader
I also tried some of the solutions on: Node Error: resolve-url-loader: CSS error
they didnt work but still could be helpful for others.

Vercel - TypeError: Cannot read property 'system' of undefined

It looks like my build is working fine. (And build fine locally).
But I get this error when deploying to Vercel.
08:04:54.329 [4/4] Building fresh packages...
08:04:56.738 success Saved lockfile.
08:04:56.742 Done in 39.69s.
08:04:56.778 Detected Next.js version: 10.0.3
08:04:56.779 Running "yarn run build"
08:04:57.063 yarn run v1.22.10
08:04:57.106 $ next build
08:04:57.789 Browserslist: caniuse-lite is outdated. Please run:
08:04:57.790 npx browserslist#latest --update-db
08:04:57.894 info - Creating an optimized production build...
08:04:57.915 Attention: Next.js now collects completely anonymous telemetry regarding usage.
08:04:57.915 This information is used to shape Next.js' roadmap and prioritize features.
08:04:57.915 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
08:04:57.915 https://nextjs.org/telemetry
08:06:05.124 info - Compiled successfully
08:06:05.125 info - Collecting page data...
08:06:07.309 > Build error occurred
08:06:07.312 TypeError: Cannot read property 'system' of undefined
08:06:07.312 at Object.get (/vercel/workpath0/node_modules/faker/lib/index.js:75:47)
08:06:07.312 at new System (/vercel/workpath0/node_modules/faker/lib/system.js:41:44)
08:06:07.312 at new Faker (/vercel/workpath0/node_modules/faker/lib/index.js:147:17)
08:06:07.312 at Object.<anonymous> (/vercel/workpath0/node_modules/faker/locale/en_US.js:2:13)
08:06:07.312 at Module._compile (internal/modules/cjs/loader.js:1063:30)
08:06:07.312 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
08:06:07.312 at Module.load (internal/modules/cjs/loader.js:928:32)
08:06:07.313 at Function.Module._load (internal/modules/cjs/loader.js:769:14)
08:06:07.317 at Module.require (internal/modules/cjs/loader.js:952:19)
08:06:07.317 at require (internal/modules/cjs/helpers.js:88:18) {
08:06:07.317 type: 'TypeError'
08:06:07.318 }
08:06:07.468 error Command failed with exit code 1.
08:06:07.469 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
08:06:07.486 Error: Command "yarn run build" exited with 1
08:06:10.181 Done with "package.json"
As #juliomalves pointed out. It was faker's fault. It was working fine, then suddenly it wasn't. I ended up just removing it from my packages.
yarn remove faker
And just stripped it out of the project as it was just being used for demo stuff. Now all good.

WP Facebbok Login - errors while loading page

I really do not know the advice. No facebook application settings work.
Thank you
XMM-b79-1BK.js:44 Uncaught Error: Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.
at a (XMM-b79-1BK.js:44)
at a (XMM-b79-1BK.js:121)
at x (XMM-b79-1BK.js:193)
at Object.b.post [as log] (XMM-b79-1BK.js:193)
at a.logVital (XMM-b79-1BK.js:219)
at XMM-b79-1BK.js:293
at Array.forEach (<anonymous>)
at IntersectionObserver.f.threshold (XMM-b79-1BK.js:293)
It is a known bug, you can subscribe here: https://developers.facebook.com/support/bugs/1337180213092053/

Is Meteor running from the wrong path?

I have just installed Meteor from the auth branch. Meteor seems to read its content from /usr/lib/meteor - But it was installed to /usr/local/meteor. /usr/local/meteor/packages contains all packages i need but when i list packages from terminal it shows the default ones. I'm trying to run a project i recently created on another computer:
Errors prevented startup:
Exception while bundling application:
Error: The package named accounts-ui does not exist.
at _.extend.init_from_library (/usr/lib/meteor/app/lib/packages.js:91:13)
at Object.module.exports.get (/usr/lib/meteor/app/lib/packages.js:225:11)
at self.api.use (/usr/lib/meteor/app/lib/bundler.js:83:28)
at Array.forEach (native)
at Function._.each._.forEach (/usr/lib/meteor/app/lib/third/underscore.js:76:11)
at Object.self.api.use (/usr/lib/meteor/app/lib/bundler.js:82:9)
at _.extend.init_from_app_dir [as on_use] (/usr/lib/meteor/app/lib/packages.js:136:11)
at _.extend.use (/usr/lib/meteor/app/lib/bundler.js:362:11)
at Object.exports.bundle (/usr/lib/meteor/app/lib/bundler.js:649:12)
at exports.run.restart_server (/usr/lib/meteor/app/meteor/run.js:509:26)
Your application is crashing. Waiting for file change.
My first thought was that some 'Meteor-path-variable' was set wrong, but i cant find something like that.
Solved - Restarted the computer..

Resources