Can't resolve 'path'
See original GitHub issueI got an error with Angular 11 project
Error: ./node_modules/sanitize-html/node_modules/postcss/lib/input.js
Module not found: Error: Can't resolve 'path' in '/Users/mkrajcir/Devel/BMB/eshop/node_modules/sanitize-html/node_modules/postcss/lib'
Error: ./node_modules/sanitize-html/node_modules/postcss/lib/map-generator.js
Module not found: Error: Can't resolve 'path' in '/Users/mkrajcir/Devel/BMB/eshop/node_modules/sanitize-html/node_modules/postcss/lib'
Error: ./node_modules/sanitize-html/node_modules/postcss/lib/previous-map.js
Module not found: Error: Can't resolve 'path' in '/Users/mkrajcir/Devel/BMB/eshop/node_modules/sanitize-html/node_modules/postcss/lib'
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Module not found: Error: Can't resolve 'path' - node.js
I'm running in the same problem. I fixed the "stream" error using a tsconfig.json path to readable-stream, but can't figure out a solution...
Read more >Module not found: Error: Can't resolve 'path' [Solved]
The error "Module not found: Error: Can't resolve 'path'" occurs because there has been a breaking change in Webpack version 5. To solve...
Read more >Resolve | webpack
Whether to resolve symlinks to their symlinked location. When enabled, symlinked resources are resolved to their real path, not their symlinked location. Note ......
Read more >Have a JavaScript Module Not Found Error ... - Airbrake Blog
If you see a “Module not found: error can't resolve” JavaScript error, there's likely a problem with the communication between the module you're...
Read more >Module not found: Error: Can't resolve 'path'_彭世瑜的技术博客
Module not found: Error: Can't resolve 'path',依赖包package.json。
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top 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
@ai: I think this is an issue in the same vein as #971, though it’s likely that
path
would need a polyfill, rather than just being set tofalse
. This is likely to show up more often, since webpack 5 removed support for automatic polyfills.If you’d prefer not to add polyfills to
postcss
, it might be worth updating the Browser docs to note that webpack doesn’t automatically polyfill node APIs any more. Perhaps noting the specific errors that folks might see would help it show up in Google searches. 🙂For downstream folks wanting to fix this in their own repo,
browserify
should work (though I haven’t tested it). Alternatively, if you’re usingwebpack
installingpath-browserify
and adding this to your webpack config should fix it:The fix by @mattcompiles was released in 8.2.7