Open line0 opened 2 years ago
This failed for me as well, but only on Windows.
The issue seems that Module._nodeModulePaths
creates duplicate drive paths for input path /D:/projects/pota-test/pota-project/node_modules/postcss-normalize
:
'D:\\D:\\projects\\pota-test\\pota-project\\node_modules\\postcss-normalize\\node_modules',
'D:\\D:\\projects\\pota-test\\pota-project\\node_modules',
'D:\\D:\\projects\\pota-test\\node_modules',
'D:\\D:\\projects\\node_modules',
'D:\\D:\\node_modules',
'D:\\D\\node_modules',
'D:\\node_modules'
When I enter the correct non-duplicated D:\\projects\\pota-test\\pota-project\\node_modules
myself manually, it does work.
Either way, removing unsupported undocumented internal function, and replacing them with the correct ones, seems like the best option :)
Yep failing for me as well. Trying to use esm module resolution.
I've come across this problem too, any chance this pr can be merged soon?
@jonathantneal friendly reminder
FYI; Another reason for this error to happen, is if you use spaces in your folder name.
When using the postcss-normalize ESM export, the resolution of the @csstools/normalize.css package location fails for me with an
Error: Cannot find module '@csstools/normalize.css'
.Not entirely sure if this is due to using yarn workspaces or a Node version incompatibility, but using the official
module.createRequire()
andrequireResolve()
APIs instead of undocumented internals fixes the issue. Confirmed to work on Node v18, but the APIs are available all the way down to Node v12, so this shouldn't break anything.Also had to fix the tests to reflect changes in @csstools/normalize.css v12.0.0.