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

[BUG] NX Monorepo errors with @types/babel__traverse #227

Closed
pchaganti opened this issue Nov 30, 2022 · 5 comments · Fixed by #232
Closed

[BUG] NX Monorepo errors with @types/babel__traverse #227

pchaganti opened this issue Nov 30, 2022 · 5 comments · Fixed by #232
Labels
bug Something isn't working

Comments

@pchaganti
Copy link

Describe the bug

Linking the description and resolution for the bug from projen as I ran into this and they helped debug it.

projen/projen#2264

Expected Behavior

No errors during compile.

Current Behavior

� compile | jsii --silence-warnings=reserved-word
[2022-11-29T17:24:08.213] [ERROR] jsii/compiler - Compilation errors prevented the JSII assembly from being created
../../../node_modules/@types/babel__traverse/index.d.ts:68:50 - error TS1005: ']' expected.

68 export type ArrayKeys<T> = keyof { [P in keyof T as T[P] extends any[] ? P : never]: P };
                                                    ~~
../../../node_modules/@types/babel__traverse/index.d.ts:68:53 - error TS1005: ';' expected.

68 export type ArrayKeys<T> = keyof { [P in keyof T as T[P] extends any[] ? P : never]: P };
                                                       ~

Reproduction Steps

npm run compile

Possible Solution

Pinning @types/babel__traverse to 7.18.2

Additional Information/Context

No response

PDK version used

0.12.20

What languages are you seeing this issue on?

Typescript

Environment details (OS name and version, etc.)

Linux x86_64

@pchaganti pchaganti added the bug Something isn't working label Nov 30, 2022
@agdimech
Copy link
Contributor

agdimech commented Nov 30, 2022

Hi. Thanks for raising this.

The PDK itself is currently being built using @types/babel__traverse@7.17.1 on NX and I don't see any build failures surfacing. Are you able to please provide more details into how this can be reproduced? A sample repo which I can trigger a build on would be ideal.

@pchaganti
Copy link
Author

The link in the projen ticket above contains a zipped test repo.

thanks

@pchaganti
Copy link
Author

Attached a test repo. node modules removed for size reasons.

Run yarn install
Run npx nx run-many --target=build --all

test_projen.zip

@agdimech
Copy link
Contributor

agdimech commented Dec 2, 2022

As a stopgap, are you able to do the following:

  1. Add this on line 14/15 after your monorepo definition in .projenrc.ts project.package.addPackageResolutions("@types/babel__traverse@7.18.2");
  2. Run npx projen from root
  3. Run npx nx run-many --target=build --all

The issue appears to be that v >= 7.18.3 do not support typescript 3.9 (JSII limitation) and hence it will need to be pinned.

Also as an aside, make sure your .projenrc.ts file only has a single call to project.synth() otherwise you will be wasting a lot of time unnecessarily waiting for things to synthesize :)

I will add a follow-up fix to NXMonorepoProject to automatically Pin this dep to 7.18.2.

@pchaganti
Copy link
Author

I am already doing the stopgap and it works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants