-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Error [ERR_MODULE_NOT_FOUND] when using tsc #41887
Comments
you may have the wrong import
|
Thanks for the quick reply, it seems really werid to reference a file which really uses |
This is the intended behavior; because TypeScript doesn't modify JavaScript code you write, the import path you write should be the one you want to appear in the output .js file |
I don't know if this is something I can relate to, but at least can there be a more indicative error/warning during the compiling process? |
This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow. |
Very interesting, we rewrote a package to use the fully-specified ESM paths with ...until we had to import some of these files in a second package that was consuming TypeScript via webpack (tried with both gatsbyjs/gatsby#31077 (comment) Then we got the opposite error, webpack +
|
Maybe this is actually a bug in either |
I was trying to import RockPaperScissor class in my controller and I was getting an error RockPaperScissor.js class RockPaperScissor{ constructor(gameMode) { } humanMoves.controllers.js import RockPaperScissor from "../../services/RockPaperScissor.js"; const rockPaperScissor = new RockPaperScissor("api"); // this is my configuration in package.json "main": "server.js", // getting error internal/process/esm_loader.js:74 Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/ibrahim/test/rock-paper-cissors-game/services/GameComponents' imported from /Users/ibrahim/test/rock-paper-cissors-game/services/RockPaperScissor.js |
node --experimental-specifier-resolution=node ./build/config.js works for me with node v18 and ts v4.8 |
this is really weird |
TypeScript Version: 4.1.2
Search Terms:
esm
,Error [ERR_MODULE_NOT_FOUND]
,internalBinding('errors')
Code
Where the directory strcture is:
config.ts
index.ts
tsconfig.json:
package.json:
Then run
npm run start
Expected behavior:
A console.log(1) in stdout.
Actual behavior:
Playground Link:
This is related to the files and imports, no way that I saw to do it in the playground.
Related Issues:
Nope.
** Extra info **
Windows 10 64 bit.
The text was updated successfully, but these errors were encountered: