Skip to content

fix: use open-cli instead of require('open') for Node 20+ compatibility - #10517

Merged
robert-hebel-sb merged 5 commits into
swagger-api:masterfrom
Ashutoshyadav01:fix/open-cli-node20
Jul 17, 2025
Merged

fix: use open-cli instead of require('open') for Node 20+ compatibility#10517
robert-hebel-sb merged 5 commits into
swagger-api:masterfrom
Ashutoshyadav01:fix/open-cli-node20

Conversation

@Ashutoshyadav01

@Ashutoshyadav01 Ashutoshyadav01 commented Jul 3, 2025

Copy link
Copy Markdown
Contributor

This PR fixes the error when running npm run start on Node.js 20+ caused by using require('open'), which no longer works due to open being ESM-only.

✅ Replaced:
"open-static": "node -e "require('open')('http://localhost:3002')\""

✅ With:
"open-static": "npx open-cli http://localhost:3002"

✅ Also added open-cli as a dev dependency.

Fixes #10516

Comment thread package-lock.json
Comment on lines -181 to -182
"resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.26.4.tgz",
"integrity": "sha512-+mORf3ezU3p3qr+82WvJSnQNE1GAYeoCfEv4fik6B5/2cvKZ75AX8oawWQdXtM9MmndooQj15Jr9kelRFWsuRw==",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these fields shouldn't be deleted

@robert-hebel-sb

Copy link
Copy Markdown
Contributor

Hey @Ashutoshyadav01! Thanks for helping us with this issue 🙏 . I've left one comment

@Ashutoshyadav01

Copy link
Copy Markdown
Contributor Author

@robert-hebel-sb Thanks for the feedback! I've now updated package-lock.json to ensure all unrelated dependencies like @babel/cli are preserved. Only open-cli has been added as intended 🙏

@robert-hebel-sb

robert-hebel-sb commented Jul 15, 2025

Copy link
Copy Markdown
Contributor

@Ashutoshyadav01 thanks for the fix! Although still there are changes in package-lock.json unrelated to open-cli package installation. Could you take a look on that?

@Ashutoshyadav01

Ashutoshyadav01 commented Jul 16, 2025

Copy link
Copy Markdown
Contributor Author

@robert-hebel-sb Thanks for your feedback , I guess now it is ready for a look.

@robert-hebel-sb

Copy link
Copy Markdown
Contributor

Thank you for your effort @Ashutoshyadav01 the PR now looks great! 😙🤌

@robert-hebel-sb
robert-hebel-sb merged commit 47a5c1f into swagger-api:master Jul 17, 2025
8 checks passed
@Ashutoshyadav01

Copy link
Copy Markdown
Contributor Author

@robert-hebel-sb Thank you so much! 😊
Glad I could contribute — looking forward to helping out more in the future!

swagger-bot pushed a commit that referenced this pull request Aug 1, 2025
## [5.27.1](v5.27.0...v5.27.1) (2025-08-01)

### Bug Fixes

* use open-cli instead of require('open') for Node 20+ compatibility ([#10517](#10517)) ([47a5c1f](47a5c1f))
@swagger-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 5.27.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

delendik-testops pushed a commit to ModiusOpenData/swagger-ui that referenced this pull request Mar 3, 2026
delendik-testops pushed a commit to ModiusOpenData/swagger-ui that referenced this pull request Mar 3, 2026
## [5.27.1](swagger-api/swagger-ui@v5.27.0...v5.27.1) (2025-08-01)

### Bug Fixes

* use open-cli instead of require('open') for Node 20+ compatibility ([swagger-api#10517](swagger-api#10517)) ([47a5c1f](swagger-api@47a5c1f))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: npm run start fails due to ESM open package in Node 20+

4 participants