question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot find module './readBuffer' when Experimental option "babelMultiThread" is enabled

See original GitHub issue

Bug report

When experimental option “babelMultiThread” is enabled, dev version does not start, giving error

internal/modules/cjs/loader.js:960
  throw err;
  ^

Error: Cannot find module './readBuffer'
Require stack:
- C:\Users\khades\projects\CODEr\node_modules\next\dist\compiled\thread-loader\worker.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (C:\Users\khades\projects\CIWD-CorpSites\Frontend\site-editor\node_modules\next\dist\compiled\thread-loader\worker.js:19:19)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\khades\\projects\\CODE\\node_modules\\next\\dist\\compiled\\thread-loader\\worker.js'
  ]
}

Describe the bug

I have project with lots of dynamic modules, that recompilation time was too long, looked through code and found that “babelMultiThread” experimental option enables cache-loader (which i really need).

So i enabled it while using next 9.3.3, it worked. I upgraded to latest canary - it broke.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Do any project with latest canary next.js
  2. Enable babelMultiThread
 experimental: { babelMultiThread: true },

in next.config.js 3. Start dev version

Expected behavior

It works, like in nextJS 9.3.3

System information

  • OS: Widnows 10
  • Browser (if applies) [e.g. chrome, safari]
  • Version of Next.js: ^9.3.7-canary.12
  • Version of Node.js: v12.16.3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
timneutkenscommented, Nov 25, 2022

This option no longer exists and Babel was superseded by SWC so I’m going to close this issue 👍

0reactions
github-actions[bot]commented, Dec 26, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node --experimental-modules - Error: Cannot find module
I'm answering my own question if anybody else has this problem. It turns out in experimental mode you need to define the full...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
In my case, I need to install the react-icons package so the freeCodeCamp icon can be resolved. I'll do that by running yarn...
Read more >
Node.js v19.3.0 Documentation
Indicates the failure of an assertion. All errors thrown by the node:assert module will be instances of the AssertionError class. new assert.AssertionError( ...
Read more >
Experiments | webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
Announcing a new --experimental-modules - Node.js - Medium
js will treat all .js files in your project as ES modules. If some of your project's files use CommonJS and you can't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found