-
Notifications
You must be signed in to change notification settings - Fork 310
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]: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in #667
[BUG]: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in #667
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 |
Please share reproducible code example |
That specific error message suggest you are not using ESM. Please see the usage section in the README: |
Hi, I have the same issue.
Octokit.js: v6.0.1 I already use ESM to import the Octokit class: |
Are you using typescript at all? In typescript just because you are importing using ESM imports doesn't mean you are using ESM |
If anyone is experiencing this issue, please give a small reproducible example in a separate repo. Include the Also don't forget to specify the environment (Browser/Node/Deno as well as the version) It would be very helpful in diagnosing this issue and helping out users. You may also want to read up on ESM packages, https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c |
Anyone found a workaround for this, i'm also experiencing same issue |
@iamnotstatic Please read my comment above. |
@wolfy1339 https://github.com/Darker935/MdgWa-TEST Run with |
@Darker935 Also, you are still using CJS in your example which explains some of the errors |
Downgrading to |
I understand that downgrading has solved the issue, I really wish to diagnose and fix this issue for users |
Okay, this was my initial config
tsconfig
|
You are using CJS and not ESM. You will need to use dynamic imports or upgrade to ESM
|
Alright thanks @wolfy1339 |
@wolfy1339 I'm getting the same error and others, setting to ESM or "node16" in tsconfig
Results in:
With:
Case package.json type = "module":
Without package.json type = "module":
With:
Results in:
My default tsconfig.json file:
I'm using "@octokit/core": "^6.0.1" and Node v18.17.0
|
You can use dynamic imports, upgrade your code to ESM, or stick with v5 Option 1: async function main() {
const { Octokit } = await import('@octokit/core');
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
}
main(); Option 2: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
Option 3:
The error in question in this issue is people that their code is CJS and are importing an ESM module. There is also bugs with At this point, there is nothing actionable on our part. This is user error |
@wolfy1339 I don't think this should've been closed out. The resolution would be to add to all octokit ".": {
"default": "path/to/entry.js"
} So many packages I've seen in the wild omit |
From how I interpret the documentation, Do you have an explanation as to why thus isn't the case? |
@wolfy1339 I've seen this happen in @JoaoScheleder @iamnotstatic @IchanZX1 @clementhemidy "exports": {
".": {
"types": "./dist-types/index.d.ts",
- "import": "./dist-src/index.js"
+ "import": "./dist-src/index.js",
+ "default": "./dist-src/index.js"
}
}, |
@jeremy-daley-kr
And it did help, but i was still getting an error. Important what helped me was switching from nodemon and ts-node to tsx.
|
* fix(pkg): add a `default` fallback export See octokit/core.js#665 octokit/core.js#667 * docs: add note on needed config changes for TypeScript
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@octokit/plugin-paginate-rest](https://togithub.com/octokit/plugin-paginate-rest.js) | [`11.1.0` -> `11.1.1`](https://renovatebot.com/diffs/npm/@octokit%2fplugin-paginate-rest/11.1.0/11.1.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@octokit%2fplugin-paginate-rest/11.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@octokit%2fplugin-paginate-rest/11.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@octokit%2fplugin-paginate-rest/11.1.0/11.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@octokit%2fplugin-paginate-rest/11.1.0/11.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>octokit/plugin-paginate-rest.js (@​octokit/plugin-paginate-rest)</summary> ### [`v11.1.1`](https://togithub.com/octokit/plugin-paginate-rest.js/releases/tag/v11.1.1) [Compare Source](https://togithub.com/octokit/plugin-paginate-rest.js/compare/v11.1.0...v11.1.1) ##### Bug Fixes - **pkg:** add default fallback and types export ([#​612](https://togithub.com/octokit/plugin-paginate-rest.js/issues/612)) ([069235f](https://togithub.com/octokit/plugin-paginate-rest.js/commit/069235f45a8b49f2bccdc9cc561ec7375d225eec)), closes [ocotkit/core.js#665](https://togithub.com/ocotkit/core.js/issues/665) [octokit/core.js#667](https://togithub.com/octokit/core.js/issues/667) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 6am on monday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/earthly/actions-setup). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMDEuNCIsInVwZGF0ZWRJblZlciI6IjM3LjMwMS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJub24tbWFqb3IiLCJyZW5vdmF0ZSJdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@octokit/request-error](https://togithub.com/octokit/request-error.js) | [`^6.0.0` -> `^6.1.1`](https://renovatebot.com/diffs/npm/@octokit%2frequest-error/6.0.2/6.1.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@octokit%2frequest-error/6.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@octokit%2frequest-error/6.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@octokit%2frequest-error/6.0.2/6.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@octokit%2frequest-error/6.0.2/6.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [octokit](https://togithub.com/octokit/octokit.js) | [`3.1.2` -> `3.2.0`](https://renovatebot.com/diffs/npm/octokit/3.1.2/3.2.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/octokit/3.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/octokit/3.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/octokit/3.1.2/3.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/octokit/3.1.2/3.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>octokit/request-error.js (@​octokit/request-error)</summary> ### [`v6.1.1`](https://togithub.com/octokit/request-error.js/releases/tag/v6.1.1) [Compare Source](https://togithub.com/octokit/request-error.js/compare/v6.1.0...v6.1.1) ##### Bug Fixes - **pkg:** add `default` fallback and `types` export ([#​419](https://togithub.com/octokit/request-error.js/issues/419)) ([a1ab11e](https://togithub.com/octokit/request-error.js/commit/a1ab11e3d9bcc065bb0f5cb1c307d295aef85505)), closes [octokit/core.js#665](https://togithub.com/octokit/core.js/issues/665) [octokit/core.js#667](https://togithub.com/octokit/core.js/issues/667) ### [`v6.1.0`](https://togithub.com/octokit/request-error.js/releases/tag/v6.1.0) [Compare Source](https://togithub.com/octokit/request-error.js/compare/v6.0.3...v6.1.0) ##### Features - **security:** Add provenance ([#​416](https://togithub.com/octokit/request-error.js/issues/416)) ([2836ddb](https://togithub.com/octokit/request-error.js/commit/2836ddb477c1b9fc0310679017776d0ff8a009c6)) ### [`v6.0.3`](https://togithub.com/octokit/request-error.js/releases/tag/v6.0.3) [Compare Source](https://togithub.com/octokit/request-error.js/compare/v6.0.2...v6.0.3) ##### Bug Fixes - **deps:** update dependency [@​octokit/types](https://togithub.com/octokit/types) to v13 ([352b655](https://togithub.com/octokit/request-error.js/commit/352b655b176d76c9c03649babaafd063227c3785)) </details> <details> <summary>octokit/octokit.js (octokit)</summary> ### [`v3.2.0`](https://togithub.com/octokit/octokit.js/releases/tag/v3.2.0) [Compare Source](https://togithub.com/octokit/octokit.js/compare/v3.1.2...v3.2.0) ##### Features - **security:** Add provenance ([#​2653](https://togithub.com/octokit/octokit.js/issues/2653)) ([a90799a](https://togithub.com/octokit/octokit.js/commit/a90799a69cb0a62f9103b395c3f26627f0402755)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/JoshuaKGoldberg/create-typescript-app). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMjEuMiIsInVwZGF0ZWRJblZlciI6IjM3LjMyMS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Is it CJS? I'm getting My tsconfig:
|
Nope it is not CJS. You haven't defined your file as an ESM module. Either use the |
What happened?
How To fix?
Versions
Octokit.js v6.0.1, Node v18.19.1
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: