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.

Regression: `Uncaught error: Cannot find module`

See original GitHub issue

I’m sorry for submitting such a general report without a small repro case. But this bug has already cost me a lot of time, and I’m very much at a loss for how to deal with it. I thought I’d file what I could, though.

🐛 bug report

Check out the following:

Run:

npm install
make clean dev

Then visit http://localhost:3333/twisty/twisty-player.html and check the browser console.

See https://www.youtube.com/watch?v=PXkfFrLHS6o for an example of a successful build (beginning of video) and 8:32 for a failure.

To avoid the behaviour:

npm install parcel@2.0.0-nightly.481 # no bug
rm -rf ./node_modules/ ; npm install; make clean dev

To cause the behaviour (sometimes):

npm install parcel@2.0.0-nightly.485 # bug
rm -rf ./node_modules/ ; npm install; make clean dev

(Parcel nightly versions 482/483/484 do not exist.)

🤔 Expected Behavior

No error. The page loads, shows a Rubik’s Cube, and a table for some options.

😯 Current Behavior

Sometimes (the vast majority of the time, maybe 90%?) after running npm install from scratch, the following error appears:

Uncaught Error: Cannot file module '2du48'.

This seems to correspond to ./dom/viewers/Twisty3DCanvas. It seems clear that there’s an issue with the loading graph somehow related to this file, starting in parcel@2.0.0-nightly.485.

See https://garron.net/temp/cubing-js-parcel-2021-01-18.zip for the state of the cache folder when this occurs.

Sometimes after running npm install (maybe 10% of the time?), however, there is no error. As far as I can tell, the error doesn’t occur until the next time I delete node_modules and run npm install from scratch, which rolls the dice again.

💁 Possible Solution

No idea, I’m sorry. I’ve tried to dig into stack traces, but something is going wrong deep inside Parcel’s module loading code and I can’t debug it from inside my code.

I can’t figure out how to map Parcel nightlies to Git commits, but correlating the version dates at https://www.npmjs.com/package/parcel with https://github.com/parcel-bundler/parcel/commits/v2?after=bdc45e49437b986934d3b1b0d8f6a4ecc292a2aa+34&branch=v2 suggests that this regression was introduced in this range:

https://github.com/parcel-bundler/parcel/compare/a4cf3e958ea1136b4829eb93615fba5328213471...f89e5ef87fcb58e6131475b5218f188cc231a1d9

🔦 Context

I was trying to debug a Parcel bug that is breaking our production build. I tried to update Parcel to the latest nightly 2.0.0-nightly.539 and was able to observe a bug in dev. After spending over 24 hours, I finally concluded that our production bug is not the same as the bug that was caused by upgrading to 2.0.0-nightly.539. I’m going to downgrade for now in order to debug the other issue, but I’ve filed this issue to document the one that happened due to the upgrade.

💻 Code Sample

See above.

🌍 Your Environment

Software Version(s)
Parcel parcel@2.0.0-nightly.485 and above (I bisected. 481 and lower do not exhibit this issue, 482/483/484 do not exist, 485 and above do exhibit the issue).)
Node v15.4.0
npm/Yarn 6.14.11
Operating System macOS 10.15.7 as well as Big Sur (I can repro this issue on two different computers)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:26 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
joeosburncommented, Nov 8, 2021

I am having the same issue with Cannot find module xxx, which corresponds to "@parcel/transformer-js/src/esmodule-helpers.js"

parcel 2.0.0 npm 8.1.0 node 16.13.0 macOS 11.6 Safari 15.0 (16612.1.29.41.4, 16612)

4reactions
joeosburncommented, Nov 8, 2021

I just updated to Parcel 2.0.1 and still having the same issue. Is this a configuration option problem in our stack or is this a bug in Parcel?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I resolve "Cannot find module" error using Node.js?
This happens when a first npm install has crashed for some reason (SIGINT of npm), or that the delay was too long, or...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
To fix the error, you need to install the package that is absent in your project directory – npm install package-name or yarn...
Read more >
Cannot find module react-bootstrap/lib/Breadcrumb
Prove that the leverage converges to 0. Do the residuals in a linear regression really approximate the errors? How to mass change many...
Read more >
Changelog - Cypress Documentation
Fixed a regression introduced in the Electron browser in Cypress 10.8.0 where the ... reporters would cause Cypress to throw a 'Cannot find...
Read more >
footer.js:11 uncaught error: cannot find module 'vue/dist/vue.js'
Describe the issue / bug. # where i run npm run dev , shows "Uncaught Error: Cannot find module 'axios'" in console, and...
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