OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.76k stars 6.56k forks source link

[BUG] [typescript-angular] Incompatible transitive dependency of `@types/node` #19522

Open liebstein opened 2 months ago

liebstein commented 2 months ago

Bug Report Checklist

Description

We're using Gradle plugin with typescript-angular generator to generate an Angular client with Angular version of 13.3.12 and Node version of v14.21.3.

When generating an SDK and running npm install && npm run build we encounter the following exception, which seem to have started only the the recent couple of days.

npm run build

> @app@2.1.3 build .../api/open-api/angular-client/build/generated/client
> ng-packagr -p ng-package.json

Building Angular Package

------------------------------------------------------------------------------
Building entry point '@app'
------------------------------------------------------------------------------
✖ Compiling with Angular sources in Ivy partial compilation mode.
node_modules/@types/node/stream/web.d.ts:469:56 - error TS1005: '?' expected.

469             DecompressionStream: infer T extends object;
                                                           ~

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @app@2.1.3 build: `ng-packagr -p ng-package.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @app@2.1.3 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

It seem to have been resulting from a transitive dependency of @types/node@22.5.2 which was recently updated and originally comes from ng-packagr dependency. https://www.npmjs.com/package/@types/node?activeTab=versions

Our current workaround is to use a legacy stable version of @types/node and executing the following command before running npm run build npm install --save-dev @types/node@18.11.9

openapi-generator version

Version 7.4.0

OpenAPI declaration file content or url
Generation Details
Steps to reproduce

Generate angular typescript client with Angular version of 13.3.12 and Node version of v14.21.3. Run npm install && npm run build

Related issues/PRs
Suggest a fix

Use a fixed version of @types/node which is compatible with legacy Node versions

cezaryrk commented 1 month ago

Same problem with @types/node version 22.5.4. Using override in package.json to downgrade to version 22.5.1.

ShuangGod commented 1 month ago

Same problem with @types/node version 22.5.4. Using override in package.json to downgrade to version 22.5.1.

well, i resolved...

brunorilla commented 1 month ago

Same here. I fixed it by adding "resolutions": { "@types/node": "22.5.1" }, in package.json