openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

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

Open liebstein opened this issue 2 years ago • 5 comments

Bug Report Checklist

  • [x] Have you provided a full/minimal spec to reproduce the issue?
  • [x] Have you validated the input using an OpenAPI validator (example)?
  • [ ] Have you tested with the latest master to confirm the issue still exists?
  • [x] Have you searched for related issues/PRs?
  • [x] What's the actual output vs expected output?
  • [ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
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

> @[email protected] 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! @[email protected] build: `ng-packagr -p ng-package.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @[email protected] 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/[email protected] 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/[email protected]

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

liebstein avatar Sep 04 '24 06:09 liebstein

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

cezaryrk avatar Sep 05 '24 19:09 cezaryrk

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

well, i resolved...

ShuangGod avatar Sep 09 '24 09:09 ShuangGod

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

brunorilla avatar Sep 11 '24 17:09 brunorilla

Do you all have any idea how we could possibly fix this, and how we might prevent similar issues from arising in the future? I'd be happy to contribute, but I can't really see at the moment how we could add a package-lock for each possible Angular version, and even if we do, how we could maintain them without it becoming a nightmare.

hunhavoc avatar Nov 29 '24 15:11 hunhavoc

is the issue still open

mwihoti avatar Sep 19 '26 12:09 mwihoti