-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Issue installing on Windows - Invalid or unexpected token #3387
Comments
It looks like esbuild's installer thinks you are installing on Linux (ELF is the executable format for Linux). I notice you are running things via
The way you installed node/npm could hypothetically also affect things. For example, if you installed it using something Linux-related (e.g. WSL), then it might think it's on Linux and/or run things as if it were on Linux. I'm not sure. But that could be something else for you to investigate. |
I've ran into this issue myself recently at work but couldn't replicate on my personal computer. I realized that there appears to be an issue with my company's on-prem npm registry, the node_modules/esbuild/bin/esbuild file was corrupted. If you're experiencing this issue then compare the bin/esbuild file from the public npm with your company's npm and see if you can get library re-uploaded. In my case the bin/esbuild file for our on-prem solution somehow became an actual binary that is 9mb. The one that comes from the public npm registry is only 9kb and is a node/shell script that's plainly readable. Note: You can use a web cdn to compare to your local https://unpkg.com/esbuild@0.18.17/bin/esbuild |
That may be part of the case, I noticed that this was only happening on Windows and not darwin/Linux, for some reason I never got this error in a Linux environment, only on Windows. But similar to the OP when installing with Note: This was happening for my on-prem npm registry for versions 0.18.x and 0.19.x, the on-prem 0.17.x versions are not corrupted. I was able to pin dependencies to v0.17.x to get successful installs. |
This is a deliberate optimization and is how the installer normally works (if |
The issue must be with our on-prem npm registry then, and/or our process for automating the syncing of libraries to the on-prem registry. I can only assume that the script my company is using to sync from global npm is doing an npm install on a linux box and then uploading the result to the registry. On windows I'm seeing the linux binary file even when using |
FYI, confirmed the tarball in my company's npm-registry has the linux binary at /bin/esbuild and not the script. I know you mentioned that the result was as designed after the post-install step, but is there a pattern you could follow that doesn't overwrite the file? I'll be working with my internal ops team to resolve the issue for us, but I'm sure this will impact more than just my company. |
And yes, sorry, I didn't mean that your package was corrupted, but that the tarball in my company's npm registry was invalid. |
Isn't |
I'll be working with the team that manages the registry at our company to fix their script. What we're doing is non-standard. I still think that maybe you should consider not overwriting the file, as we may not be the only ones impacted (say if someone does something silly and zips their project over to another machine after post-install, or the filesystem gets mounted on a different host with something like docker). There should be a way to Either way, thank you for making an awesome library! 😄 |
Hi I get this issue coming from esbuild's install script. This has been happening forever. I have checked #2929 and #1703 and #2812 but couldn't find any similarities despite nearly the exact same error log. My environment does not contain ESBUILD_BINARY_PATH.
I am behind a corporate npm registry and wouldn't be surprised if something got changed in the esbuild package.json somehow.
If I install with --ignore-scripts, the node_modules looks like this:
The text was updated successfully, but these errors were encountered: