octokit.js: [BUG]: Unable to import from Skypack CDN

What happened?

Error loading https://cdn.skypack.dev/@octokit/core from CDN.

[Package Error] “lru-cache@v9.1.1” could not be built. (Imported by “@octokit/auth-app”).

Details are here: https://github.com/skypackjs/skypack-cdn/issues/354

Versions

https://cdn.skypack.dev/@octokit/core

Relevant log output

/*

[Package Error] "lru-cache@v9.1.1" could not be built. (Imported by "@octokit/auth-app").
[1/5] Verifying package is valid…
[2/5] Installing dependencies from npm…
[3/5] Building package using esinstall…
Running esinstall...
Failed to load node_modules/lru-cache/dist/mjs/index.js
Unexpected token (406:4) in lru-cache/dist/mjs/index.js
Install failed.
Install failed.
How to fix:
If you believe this to be an error in Skypack, file an issue here: https://github.com/skypackjs/skypack-cdn/issues
If you believe this to be an issue in the package, share this URL with the package authors to help them debug & fix.
Use https://skypack.dev/ to find a web-friendly alternative to find another package.
*/
console.warn("[Package Error] "lru-cache@v9.1.1" could not be built. (Imported by "@octokit/auth-app").\n[1/5] Verifying package is valid…\n[2/5] Installing dependencies from npm…\n[3/5] Building package using esinstall…\nRunning esinstall...\nFailed to load node_modules/lru-cache/dist/mjs/index.js\n Unexpected token (406:4) in lru-cache/dist/mjs/index.js\nInstall failed.\nInstall failed.");
throw new Error("[Package Error] "lru-cache@v9.1.1" could not be built. (Imported by "@octokit/auth-app").");
export default null;

Code of Conduct

  • I agree to follow this project’s Code of Conduct

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 5
  • Comments: 32 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Please try using the version on esm.sh instead. There seems to be a problem with Skypack

Switch your imports to https://esm.sh/octokit

I am facing the same issue with >=2.0.15

import { App, Octokit } from 'https://cdn.skypack.dev/octokit?dts';

Error: [Package Error] "lru-cache@v9.1.1" could not be built. (Imported by "@octokit/auth-app").
    at https://cdn.skypack.dev/error/build:lru-cache@v9.1.1-t7cOEoLX2RvAxMKlhTnV?from=@octokit/auth-app:20:7

https://cdn.skypack.dev/octokit@2.0.14?dts seems to be the last workable version.

Yes, please open an issue on that repository.

I’ll have to look into that. The export is definitely there in the source code

This is the line it chokes on for you: https://unpkg.com/browse/lru-cache@9.1.1/dist/mjs/index.js#L406

The # is a private class field, it’s supported since Node 12? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields

Private class fields is an ES2022 feature, while the Skypack CDN uses ES2019 which makes it choke on that line.

https://dev.to/smitterhane/private-class-fields-in-javascript-es2022-3b8

The feature may have been supported in NodeJS v12 back when it was still a proposal and not ratified into the ECMAScript spec

@ipselon @Netail Can you try again, with this new release

import { Octokit } from "https://esm.sh/octokit@2.0.19";

This import is resolving our issues in Deno. Thank you!

@ipselon @Netail Can you try again, with this new release

import { Octokit } from "https://esm.sh/octokit@2.0.19";

@Netail Thank you for your valuable comment! I’ll keep tracking on this error:)