Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't load a module from TypeScript using ts-node #13

Closed
jcubic opened this issue Mar 6, 2023 · 1 comment
Closed

Can't load a module from TypeScript using ts-node #13

jcubic opened this issue Mar 6, 2023 · 1 comment

Comments

@jcubic
Copy link

jcubic commented Mar 6, 2023

got this error:

/home/kuba/projects/jcubic/koduj/akademia/quiz/node_modules/ts-node/dist/index.js:851
            return old(m, filename);
                   ^
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/kuba/projects/jcubic/koduj/akademia/quiz/node_modules/uuidjs/dist/uuid.js from /home/kuba/projects/jcubic/koduj/akademia/quiz/utils.ts not supported.
Instead change the require of uuid.js in /home/kuba/projects/jcubic/koduj/akademia/quiz/utils.ts to a dynamic import() which is available in all CommonJS modules.
    at require.extensions.<computed> [as .js] (/home/kuba/projects/jcubic/koduj/akademia/quiz/node_modules/ts-node/dist/index.js:851:20)                                                           
    at Object.<anonymous> (/home/kuba/projects/jcubic/koduj/akademia/quiz/utils.ts:4:18)
    at m._compile (/home/kuba/projects/jcubic/koduj/akademia/quiz/node_modules/ts-node/dist/index.js:857:29)                                                                               
    at require.extensions.<computed> [as .ts] (/home/kuba/projects/jcubic/koduj/akademia/quiz/node_modules/ts-node/dist/index.js:859:16)                                                           
    at Object.<anonymous> (/home/kuba/projects/jcubic/koduj/akademia/quiz/app.ts:21:17)
    at m._compile (/home/kuba/projects/jcubic/koduj/akademia/quiz/node_modules/ts-node/dist/index.js:857:29)                                                                               
    at require.extensions.<computed> [as .ts] (/home/kuba/projects/jcubic/koduj/akademia/quiz/node_modules/ts-node/dist/index.js:859:16)                                                           
    at phase4 (/home/kuba/projects/jcubic/koduj/akademia/quiz/node_modules/ts-node/dist/bin.js:466:20
)                                                                                                   
    at bootstrap (/home/kuba/projects/jcubic/koduj/akademia/quiz/node_modules/ts-node/dist/bin.js:54:12)                                                                                  
    at main (/home/kuba/projects/jcubic/koduj/akademia/quiz/node_modules/ts-node/dist/bin.js:33:12)
    at Object.<anonymous> (/home/kuba/projects/jcubic/koduj/akademia/quiz/node_modules/ts-node/dist/bin.js:579:5) {                                                                                
  code: 'ERR_REQUIRE_ESM'
}
@LiosK
Copy link
Owner

LiosK commented Mar 8, 2023

Common JS entry point is not provided. You have to configure your ts-node to use ES Modules.

@LiosK LiosK closed this as completed May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants