core.js: [BUG]: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in
What happened?
How To fix?
Versions
Octokit.js v6.0.1, Node v18.19.1
Relevant log output
node:internal/errors:496
ErrorCaptureStackTrace(err);
^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /home/container/node_modules/@octokit/core/package.json
at new NodeError (node:internal/errors:405:5)
at exportsNotFound (node:internal/modules/esm/resolve:366:10)
at packageExportsResolve (node:internal/modules/esm/resolve:656:13)
at resolveExports (node:internal/modules/cjs/loader:584:36)
at Module._findPath (node:internal/modules/cjs/loader:658:31)
at Module._resolveFilename (node:internal/modules/cjs/loader:1120:27)
at Module._load (node:internal/modules/cjs/loader:975:27)
at Module.require (node:internal/modules/cjs/loader:1225:19)
at require (node:internal/modules/helpers:177:18)
at Object.<anonymous> (/home/container/index.js:31:21) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Node.js v18.19.1
Code of Conduct
- I agree to follow this project’s Code of Conduct
About this issue
- Original URL
- State: closed
- Created 4 months ago
- Reactions: 2
- Comments: 24 (14 by maintainers)
Commits related to this issue
- fix(pkg): add a default fallback See #665 #667 — committed to octokit/core.js by wolfy1339 3 months ago
- fix(pkg): add `default` fallback and `types` export (#673) * fix(pkg): add a default fallback See #665 #667 * fix(pkg): add an export for `dist-types/types.d.ts` Many people are importing fr... — committed to octokit/core.js by wolfy1339 3 months ago
- fix(pkg): add a default fallback See ocotkit/core.js#665 octokit/core.js#667 — committed to octokit/plugin-paginate-rest.js by wolfy1339 3 months ago
- fix(pkg): add a default fallback See octokit/core.js#665 octokit/core.js#667 — committed to octokit/request-error.js by wolfy1339 3 months ago
- fix(pkg): add a `default` fallback export See octokit/core.js#665 octokit/core.js#667 — committed to octokit/endpoint.js by wolfy1339 3 months ago
- fix(pkg): add a `default` fallback export See octokit/core.js#665 octokit/core.js#667 — committed to octokit/plugin-rest-endpoint-methods.js by wolfy1339 3 months ago
- fix(pkg): add default fallback and types export (#612) * fix(pkg): add a default fallback See ocotkit/core.js#665 octokit/core.js#667 * docs: add note on needed config changes for TypeScript ... — committed to octokit/plugin-paginate-rest.js by wolfy1339 3 months ago
- fix(pkg): add a default fallback export (#480) * fix(pkg): add a `default` fallback export See octokit/core.js#665 octokit/core.js#667 * docs(README): add note on needed config changes for Typ... — committed to octokit/endpoint.js by wolfy1339 3 months ago
- fix(pkg): add `default` fallback and `types` export (#419) * fix(pkg): add a default fallback See octokit/core.js#665 octokit/core.js#667 * docs: add note on needed config changes for TypeScrip... — committed to octokit/request-error.js by wolfy1339 2 months ago
- fix(pkg): add a `default` fallback export (#733) * 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 — committed to octokit/plugin-rest-endpoint-methods.js by wolfy1339 2 months ago
- Update dependency @octokit/plugin-paginate-rest to v11.1.1 (#91) [](https://renovatebot.com) This PR contains the following updates: |... — committed to earthly/actions-setup by renovate[bot] 2 months ago
- chore(deps): update octokit monorepo (#1483) [](https://renovatebot.com) This PR contains the following updates: | Package | Change | ... — committed to JoshuaKGoldberg/create-typescript-app by renovate[bot] 2 months ago
You can use dynamic imports, upgrade your code to ESM, or stick with v5
Option 1:
Option 2: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
tsconfig.json:package.json:Option 3:
package.json: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
ts-nodewhere it can’t handle ESM: https://github.com/TypeStrong/ts-node/issues/2094 https://github.com/TypeStrong/ts-node/issues/2100At this point, there is nothing actionable on our part. This is user error
You are using CJS and not ESM. You will need to use dynamic imports or upgrade to ESM