mike-lischke / antlr4ng

Next Generation TypeScript runtime for ANTLR4
Other
65 stars 11 forks source link

Can't build antlr4ng #48

Closed kaby76 closed 3 months ago

kaby76 commented 3 months ago

Just did a clone and trying to build antlr4ng. I'm getting a compilation error.

$ node --version
v21.7.1
03/15-08:23:49 ~/temp/antlr4ng
$ npm run build

> antlr4ng@3.0.3 build
> tsc && npm run build-cjs && npm run build-mjs

src/misc/ParseCancellationException.ts:17:15 - error TS2339: Property 'captureStackTrace' does not exist on type 'ErrorConstructor'.

17         Error.captureStackTrace(this, ParseCancellationException);
                 ~~~~~~~~~~~~~~~~~

src/RecognitionException.ts:53:19 - error TS2339: Property 'captureStackTrace' does not exist on type 'ErrorConstructor'.

53         if (Error.captureStackTrace) {
                     ~~~~~~~~~~~~~~~~~

src/RecognitionException.ts:54:19 - error TS2339: Property 'captureStackTrace' does not exist on type 'ErrorConstructor'.

54             Error.captureStackTrace(this, RecognitionException);
                     ~~~~~~~~~~~~~~~~~

Found 3 errors in 2 files.

Errors  Files
     1  src/misc/ParseCancellationException.ts:17
     2  src/RecognitionException.ts:53
03/15-08:23:57 ~/temp/antlr4ng
$ tsc --version
Version 5.4.2
03/15-08:29:29 ~/temp/antlr4ng

I have the latest of node and tsc for Windows 11.

mike-lischke commented 3 months ago

I assume you have installed the dependencies. I see these errors when I have no node_modules folder.

kaby76 commented 3 months ago

I assume you have installed the dependencies.

What dependencies? Can you add to the project.json dependency tests or requirements so that the build can output what I need to install? Otherwise I have no clue. (Commenting out above source to get past compilation errors, I now get this.)

$ !npm
npm run build

> antlr4ng@3.0.3 build
> tsc && npm run build-cjs && npm run build-mjs

> antlr4ng@3.0.3 build-cjs
> npm run build-bundle -- --outfile=dist/index.cjs --format=cjs

> antlr4ng@3.0.3 build-bundle
> esbuild ./src/index.js --main-fields=module,main --bundle --target=esnext --keep-names --outfile=dist/index.cjs --format=cjs

'esbuild' is not recognized as an internal or external command,
operable program or batch file.
03/15-09:11:14 ~/temp/antlr4ng
mike-lischke commented 3 months ago

Right after cloning the repo run npm i in its root folder to install the dev dependencies. It's so common in TypeScript projects, I haven't documented that šŸ™‚

mike-lischke commented 3 months ago

I have now added a chapter with the build instructions to the readme file.

kaby76 commented 3 months ago

Fixed with instructions in readme.