octokit / core.js

Extendable client for GitHub's REST & GraphQL APIs
MIT License
1.18k stars 307 forks source link

[BUG]: `No "exports" main defined` in version 6.0.1 #665

Closed marekdedic closed 6 months ago

marekdedic commented 6 months ago

What happened?

I updated @octokit/core to v6.0.1 and now I get the following error. See skaut/poptavky#1373

Versions

@octokit/core v6.0.1

Relevant log output

Error: No "exports" main defined in /home/user/project/node_modules/@octokit/core/package.json
    at exportsNotFound (node:internal/modules/esm/resolve:303:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:593:13)
    at resolveExports (node:internal/modules/cjs/loader:591:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:668:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1130:27)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/home/user/project/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/home/user/project/src/octokit.ts:1:1) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Code of Conduct

github-actions[bot] commented 6 months ago

👋 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 Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

wolfy1339 commented 6 months ago

We switched to ESM and you need to use the following options in your tsconfig.json:

"moduleResolution": "node16",
"module": "node16"
marekdedic commented 6 months ago

Hi, thank you, unfortunately after adding that, the issue still persists. :(

wolfy1339 commented 6 months ago

You need to use ESM, right now your are outputting CJS https://typestrong.org/ts-node/docs/imports#native-ecmascript-modules

github-actions[bot] commented 5 months ago

:tada: This issue has been resolved in version 6.1.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: