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

Cannot find module ‘node_modules\antlr4ts\atn\ATN‘ #525

Open
iaa3906 opened this issue Mar 11, 2022 · 1 comment
Open

Cannot find module ‘node_modules\antlr4ts\atn\ATN‘ #525

iaa3906 opened this issue Mar 11, 2022 · 1 comment

Comments

@iaa3906
Copy link

iaa3906 commented Mar 11, 2022

When I run the TS file compiled by antlr4ts, the following error is prompted:
CustomError: Cannot find module 'C:\MyProjects\GaeaTransFormulaApiTs\node_modules\antlr4ts\atn\ATN' imported from C:\MyProjects\GaeaTransFormulaApiTs\src\antlr\tdx\TdxParser.ts

Error source code:
import { ATN } from "antlr4ts/atn/ATN"; import { ATNDeserializer } from "antlr4ts/atn/ATNDeserializer"; ...

my tsconfig.json:
{ "compilerOptions": { "target": "esnext", "module": "esnext", "types": ["node"], "moduleResolution": "node", "strict": true, "lib": ["esnext", "dom"], "sourceMap": false, "resolveJsonModule": true, "esModuleInterop": true, "baseUrl": ".", "outDir": "./dist" }, "include": ["src/**/*.ts", "src/**/*.d.ts", "src/antlr/tdx/TdxParser.js"] }

my run script:
nodemon -e ts --exec node --loader ts-node/esm src/app.ts

my antlr4ts version:
^0.5.0-alpha.4

my typescript version:
^4.6.2

@XiLaiTL
Copy link

XiLaiTL commented Feb 11, 2023

Hey gay, #543
or set modeulresolution to "node" and use commonjs as module

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