-
Notifications
You must be signed in to change notification settings - Fork 1k
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]: Octokit 4 can't be import
ed or require
d
#2676
Comments
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with |
I'm finding that CJS can't use Octokit 4 either:
require('octokit')
|
import
ed or require
d
Sorry that is my fault. I forgot to change the build script |
This comment was marked as outdated.
This comment was marked as outdated.
🎉 This issue has been resolved in version 4.0.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I confirmed that this works now: // test.mjs
import { Octokit } from "octokit";
console.log(Octokit.VERSION);
// 6.1.2 |
I'm still facing the issue with nestjs. I solved it by downgrading it to version 3. This solved my issue |
NestJS can't do ESM only packages. There is a new NodeJS feature that can allow you to use You can also use If you are stuck on a version of Node that is older, and require CJS stick to v3 of Octokit. Please open a new issue with proper information if ever you encounter an issue like this again |
What happened?
This should work:
a.mjs
:However this fails with a module loading error (see later).
Note that
octokit@4.0.1
ships with"type": "module"
in itspackage.json
, indicating a pure ESM package, but"main"
points todist-node/index.js
, which is clearly a CJS module making use ofmodule.exports
andrequire
. Something's gone wrong here.Versions
Octokit 4.0.1, Node.js 18.17.1
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: