Module not found errors of index.js and foreign.js
See original GitHub issueI’ve attempted to predominantly mimic the example you link, but am at a total loss after several hours as to why it is trying to require files with these names in the first place.
From what I understand this is going wrong internally within webpack when it’s attempting to “require” the files resulting from compilation. My suspicion is that because the purescript compiler for 0.12 outputs compiled files to a separate “output” folder, which then isn’t resolving.
If I find the solution I’ll add it here, and you can lose the issue, but at least a closed issue might help the next person who loses their mind like me 💃
Here’s a few examples:
ERROR in ./bower_components/purescript-prelude/src/Data/Ord.purs
Module not found: Error: Can't resolve '../Data.Ordering/index.js' in '/home/alexa/Workspace/my-selfcare-client/bower_components/purescript-prelude/src/Data'
@ ./bower_components/purescript-prelude/src/Data/Ord.purs 6:20-56
@ ./bower_components/purescript-prelude/src/Prelude.purs
@ ./src/App.purs
@ multi (webpack)-dev-server/client?http://localhost:4008 webpack/hot/dev-server ./src/App.purs
ERROR in ./bower_components/purescript-prelude/src/Data/Ord/Unsafe.purs
Module not found: Error: Can't resolve '../Data.Ordering/index.js' in '/home/alexa/Workspace/my-selfcare-client/bower_components/purescript-prelude/src/Data/Ord'
@ ./bower_components/purescript-prelude/src/Data/Ord/Unsafe.purs 4:20-56
@ ./bower_components/purescript-prelude/src/Data/Ord.purs
@ ./bower_components/purescript-prelude/src/Prelude.purs
@ ./src/App.purs
@ multi (webpack)-dev-server/client?http://localhost:4008 webpack/hot/dev-server ./src/App.purs
ERROR in ./bower_components/purescript-prelude/src/Prelude.purs
Module not found: Error: Can't resolve '../Data.Ring/index.js' in '/home/alexa/Workspace/my-selfcare-client/bower_components/purescript-prelude/src'
@ ./bower_components/purescript-prelude/src/Prelude.purs 24:16-48
@ ./src/App.purs
@ multi (webpack)-dev-server/client?http://localhost:4008 webpack/hot/dev-server ./src/App.purs
ERROR in ./bower_components/purescript-prelude/src/Data/Field.purs
Module not found: Error: Can't resolve '../Data.Ring/index.js' in '/home/alexa/Workspace/my-selfcare-client/bower_components/purescript-prelude/src/Data'
@ ./bower_components/purescript-prelude/src/Data/Field.purs 6:16-48
@ ./bower_components/purescript-prelude/src/Prelude.purs
@ ./src/App.purs
@ multi (webpack)-dev-server/client?http://localhost:4008 webpack/hot/dev-server ./src/App.purs
ERROR in ./bower_components/purescript-prelude/src/Data/CommutativeRing.purs
Module not found: Error: Can't resolve '../Data.Ring/index.js' in '/home/alexa/Workspace/my-selfcare-client/bower_components/purescript-prelude/src/Data'
@ ./bower_components/purescript-prelude/src/Data/CommutativeRing.purs 3:16-48
@ ./bower_components/purescript-prelude/src/Prelude.purs
@ ./src/App.purs
@ multi (webpack)-dev-server/client?http://localhost:4008 webpack/hot/dev-server ./src/App.purs
ERROR in ./bower_components/purescript-prelude/src/Data/Ord.purs
Module not found: Error: Can't resolve '../Data.Ring/index.js' in '/home/alexa/Workspace/my-selfcare-client/bower_components/purescript-prelude/src/Data'
@ ./bower_components/purescript-prelude/src/Data/Ord.purs 7:16-48
@ ./bower_components/purescript-prelude/src/Prelude.purs
@ ./src/App.purs
@ multi (webpack)-dev-server/client?http://localhost:4008 webpack/hot/dev-server ./src/App.purs
ERROR in ./bower_components/purescript-prelude/src/Data/DivisionRing.purs
Module not found: Error: Can't resolve '../Data.Ring/index.js' in '/home/alexa/Workspace/my-selfcare-client/bower_components/purescript-prelude/src/Data'
@ ./bower_components/purescript-prelude/src/Data/DivisionRing.purs 4:16-48
@ ./bower_components/purescript-prelude/src/Prelude.purs
@ ./src/App.purs
@ multi (webpack)-dev-server/client?http://localhost:4008 webpack/hot/dev-server ./src/App.purs
ERROR in ./bower_components/purescript-prelude/src/Data/EuclideanRing.purs
Module not found: Error: Can't resolve '../Data.Ring/index.js' in '/home/alexa/Workspace/my-selfcare-client/bower_components/purescript-prelude/src/Data'
@ ./bower_components/purescript-prelude/src/Data/EuclideanRing.purs 8:16-48
@ ./bower_components/purescript-prelude/src/Prelude.purs
@ ./src/App.purs
@ multi (webpack)-dev-server/client?http://localhost:4008 webpack/hot/dev-server ./src/App.purs
ERROR in ./bower_components/purescript-prelude/src/Data/Function.purs
Module not found: Error: Can't resolve '../Data.Ring/index.js' in '/home/alexa/Workspace/my-selfcare-client/bower_components/purescript-prelude/src/Data'
@ ./bower_components/purescript-prelude/src/Data/Function.purs 6:16-48
@ ./bower_components/purescript-prelude/src/Prelude.purs
@ ./src/App.purs
@ multi (webpack)-dev-server/client?http://localhost:4008 webpack/hot/dev-server ./src/App.purs
ERROR in ./bower_components/purescript-prelude/src/Data/Ord/Unsafe.purs
Module not found: Error: Can't resolve './foreign.js' in '/home/alexa/Workspace/my-selfcare-client/bower_components/purescript-prelude/src/Data/Ord'
@ ./bower_components/purescript-prelude/src/Data/Ord/Unsafe.purs 3:15-38
@ ./bower_components/purescript-prelude/src/Data/Ord.purs
@ ./bower_components/purescript-prelude/src/Prelude.purs
@ ./src/App.purs
@ multi (webpack)-dev-server/client?http://localhost:4008 webpack/hot/dev-server ./src/App.purs
ERROR in ./bower_components/purescript-prelude/src/Record/Unsafe.purs
Module not found: Error: Can't resolve './foreign.js' in '/home/alexa/Workspace/my-selfcare-client/bower_components/purescript-prelude/src/Record'
@ ./bower_components/purescript-prelude/src/Record/Unsafe.purs 3:15-38
@ ./bower_components/purescript-prelude/src/Data/Eq.purs
@ ./bower_components/purescript-prelude/src/Prelude.purs
@ ./src/App.purs
@ multi (webpack)-dev-server/client?http://localhost:4008 webpack/hot/dev-server ./src/App.purs
Issue Analytics
- State:
- Created 5 years ago
- Comments:21 (12 by maintainers)
Top Results From Across the Web
Error [ERR_MODULE_NOT_FOUND]: Cannot find module
This answer was the one that helped me! I was using import and the file was .js - Adding --es-module-specifier-resolution=node saved the day...
Read more >Have a JavaScript Module Not Found Error ... - Airbrake Blog
If you're seeing a "module not found: error: can't resolve," in your Javascript code, here's an explanation as to why and how to...
Read more >Cannot find module 'X' error in Node.js | bobbyhadz
To solve the "Cannot find module" error in Node.js, make sure to install the package from the error message if it's a third-party...
Read more >Errors | Node.js v19.3.0 Documentation
System errors triggered by underlying operating system constraints such as attempting to open a file that does not exist or attempting to send...
Read more >Documentation - Module Resolution - TypeScript
Finally, if the compiler could not resolve the module, it will log an error. In this case, the error would be something like...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closing because I believe the original issue in this post has been resolve. Moving further discussion to #115.
Thanks for the PR. I’ve merged it while we work on this issue.