Skip to content
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

Self hosted - 405 Response using the npm.pkg.github.com registry #821

Closed
GianlucaGuarini opened this issue Apr 24, 2024 · 3 comments
Closed

Comments

@GianlucaGuarini
Copy link
Contributor

GianlucaGuarini commented Apr 24, 2024

Hi there,
I am using a self-hosted instance of esm.sh pointing to the github registry.

However anytime I try to load a package I get always the same response:

hrow new Error([esm.sh] npm: could not get metadata of package '@my-org/my-package' (405 Method Not Allowed: ));

Is there anything special that I need to tweek in my config?

{
  "port": 8080,
  "workDir": "/path/to/workdir",
  "storage": "local:/path/to/storage",
  "npmRegistryScope": "@my-org",
  "npmRegistry": "https://npm.pkg.github.com",
  "npmToken": "xxx"
}

Note that with curl everything works just fine:

curl -H "Authorization: Bearer xxx" https://npm.pkg.github.com/@my-org/my-package

Thank you for this awesome project!

@GianlucaGuarini
Copy link
Contributor Author

It seems that commenting out [this condition] fixed the issue

esm.sh/server/npm.go

Lines 252 to 254 in c537282

if isFullVersion && !isJsrScope {
url += "/" + version
}
)

So I guess that the github registry doesn't use the same npm registry paths

@ije
Copy link
Member

ije commented Apr 25, 2024

It seems that commenting out [this condition] fixed the issue

esm.sh/server/npm.go

Lines 252 to 254 in c537282

if isFullVersion && !isJsrScope {
url += "/" + version
}

)
So I guess that the github registry doesn't use the same npm registry paths

yes! seems GitHub doesn't support URL 'https://npm.pkg.github.com/pkg/1.0.0', would you like to create a PR? or i will fix it later. thanks 💯

GianlucaGuarini added a commit to GianlucaGuarini/esm.sh that referenced this issue Apr 25, 2024
@GianlucaGuarini
Copy link
Contributor Author

would you like to create a PR? or i will fix it later. thanks 💯

You are welcome :)

@ije ije closed this as completed in 66bdde0 Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants