Regression: `Uncaught error: Cannot find module`
See original GitHub issueI’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:
- Repo: https://github.com/cubing/cubing.js
- Commit: 3ff0968e92a46d14c2a1dad4f18080b6313f3949
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:
🔦 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:
- Created 3 years ago
- Reactions:2
- Comments:26 (4 by maintainers)

Top Related StackOverflow Question
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)
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?