Skip to content

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

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

Merged

Conversation

Ashutoshyadav01
Copy link
Contributor

@Ashutoshyadav01 Ashutoshyadav01 commented Jul 3, 2025

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 on lines 181 to 182
"resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.26.4.tgz",
"integrity": "sha512-+mORf3ezU3p3qr+82WvJSnQNE1GAYeoCfEv4fik6B5/2cvKZ75AX8oawWQdXtM9MmndooQj15Jr9kelRFWsuRw==",
Copy link
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
Contributor

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

@Ashutoshyadav01
Copy link
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
Copy link
Contributor

robert-hebel-sb commented Jul 15, 2025

@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
Copy link
Contributor Author

Ashutoshyadav01 commented Jul 16, 2025

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

@robert-hebel-sb
Copy link
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
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
Contributor

🎉 This PR is included in version 5.27.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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+
3 participants