Module resolution errors
See original GitHub issueI have a NextJs app inside a monorepo. Pacakges are built using Nx
package.json
"dependencies": {
"@deepkit/type": "^1.0.1-alpha.58",
[...]
}
Yarn install log
yarn install v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > @deepkit/type@1.0.1-alpha.58" has unmet peer dependency "@deepkit/core@^1.0.1-alpha.13".
warning " > @deepkit/type@1.0.1-alpha.58" has unmet peer dependency "reflect-metadata@^0.1.13".
[...]
I try to build
nx build
I get
../../node_modules/@deepkit/type/dist/esm/src/decorators.js
Module not found: Can't resolve '@deepkit/core' in '[path-omitted]\node_modules\@deepkit\type\dist\esm\src'
Looking at the yarn log, I then see that It’s messing a peer dependency to “@deepkit/core@^1.0.1-alpha.13” “reflect-metadata”: “^0.1.13”
So I added those.
Then the build error becomes
Cannot find module '[path-omitted]\node_modules\@deepkit\type\dist\esm\src\types' imported from [path-omitted]\node_modules\@deepkit\type\dist\esm\index.js
Any ideas?
Issue Analytics
- State:
- Created 2 years ago
- Comments:18 (7 by maintainers)
Top Results From Across the Web
Webpack and TypeScript: module resolution error
[1] [nodemon] app crashed - waiting for file changes before starting... I know this is a common error, but I'm not sure how...
Read more >Documentation - Module Resolution - TypeScript
Module resolution is the process the compiler uses to figure out what an import refers to. Consider an import statement like import {...
Read more >Common TypeScript module problems and how to solve them
Enabling the compiler module resolution tracing in TypeScript can provide insight in diagnosing and solving problems.
Read more >"moduleResolution": "NodeNext" throws ESM related errors ...
I am seeing an issue similar to this where the addition of NodeNext module resolution throws an incorrect error when using it with...
Read more >Module Resolution - webpack
A resolver is a library which helps in locating a module by its absolute path. A module can be required as a dependency...
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 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
TypeScript’s compiler does not support Node’s default ESM resolution algorithm. They have introduced it in version 4.5 beta https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/#esm-nodejs, but dropped it in the final 4.5 due to issues. To enable the commonly used module resolution algorithm you have to pass to node
--experimental-specifier-resolution=node
. You can also configure that in your environment variableNODE_OPTIONS=--experimental-specifier-resolution=node
. If nextjs supports passing custom node arguments, you can configure it there.@productdevbook If nuxt / next uses ESM and the file extensions were the only problem, then yes, but I don’t know if there are other problems, we will see once the PR is merged and a new release is released