esm.sh icon indicating copy to clipboard operation
esm.sh copied to clipboard

Unable to deploy docker image on internal network -- "failed to install cjs-module-lexer"

Open 14lclark opened this issue 11 months ago • 5 comments

Problem

I'm attempting to deploy the v136 Docker image on an intranet k8s cluster.

We restrict incoming and outgoing traffic, so it isn't able reach out to GitHub to clone and build the "esm-dev/cjs-module-lexer" repository once running. This prevents us from deploying a working esm.sh server, despite having an internal npm repo.

Requested solution

Build this ahead of time and include it inside the image so that it will still work regardless of the ability to reach GitHub.

Edit:

I should also note that v135_7 works fine because it doesn't attempt to reach out to GitHub.

14lclark avatar Jan 30 '25 22:01 14lclark

so you don't use '/gh/repo/PATH' pattern right?

ije avatar Jan 31 '25 01:01 ije

Sorry, not familiar with that pattern, so I'd have to say no.

14lclark avatar Jan 31 '25 01:01 14lclark

@ije Sorry for the ping, just wanting to follow up on this. Is there a possibility of getting the pre-built cjs-module-lexer into the official container?

Otherwise, could you let me know where in the container the compiled version should go so that I can build it myself?

14lclark avatar Feb 28 '25 00:02 14lclark

you can find the pre-built cjs-module-lexer in https://github.com/esm-dev/cjs-module-lexer/releases based on your arch.

and you need to rename the binary file to /esm/bin/cjs-module-lexer after downloading

ije avatar Feb 28 '25 08:02 ije

here is how the server download the binary dynamically:

https://github.com/esm-dev/esm.sh/blob/fe6d4e1758a085aaad957e32926b3aef7ee3e273/server/cjs_module_lexer.go#L153-L230

ije avatar Feb 28 '25 08:02 ije