continue icon indicating copy to clipboard operation
continue copied to clipboard

Wrong architecture installed for esbuild

Open werdnum opened this issue 7 months ago • 10 comments

Before submitting your bug report

Relevant environment info

- OS: Running via container on Kubernetes/k3s on Raspberry Pi 5.
- Continue: v0.6.17
- IDE:
code-server: v4.20.0
Code: 1.85.1
Commit: 0b84523121d6302fbe30eda7899ec3b81810748e
Date: 2023-12-18T20:21:20.879Z (2 wks ago)
Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Description

When I try to use Continue, I get this error message pop up regularly:

Build error. Please check your config.ts file: Error: You installed esbuild for another platform than the one you're currently using. This won't work because esbuild is written with native code and needs to install a platform-specific binary executable. Specifically the "@esbuild/linux-x64" package is present but this platform needs the "@esbuild/linux-arm64" package instead. People often get into this situation by installing esbuild on Windows or macOS and copying "node_modules" into a Docker image that runs Linux, or by copying "node_modules" between Windows and WSL environments. If you are installing with npm, you can try not copying the "node_modules" directory when you copy the files over, and running "npm ci" or "npm install" on the destination platform after the copy. Or you could consider using yarn instead of npm which has built-in support for installing a package on multiple platforms simultaneously. If you are installing with yarn, you can try listing both this platform ...

To reproduce

  1. Install Continue
  2. Open the side panel and try to do the tutorial
  3. The tutorial works, but I get this error message repeatedly.

Log output

Can't find any of the logs here - developer tools does not seem to exist for code-server and can't find anything Continue related anywhere.

werdnum avatar Jan 05 '24 03:01 werdnum

@werdnum thanks for bringing this up—I know just the fix, same thing we're doing to work around GitHub Actions not supporting Mac ARM. Will update here when resolved

sestinj avatar Jan 05 '24 08:01 sestinj

Anything I can do myself as a workaround?

werdnum avatar Jan 06 '24 09:01 werdnum

I am just to comment I have the same problem, but with Windows on ARM where it seems that @esbuild/win32-arm64 is needed, so if you will be fixing that, please do not forget (both ;)) Windows on ARM users.

Build error. Please check your config.ts file: Error: 
You installed esbuild for another platform than the one you're currently using.
This won't work because esbuild is written with native code and needs to
install a platform-specific binary executable.

Specifically the "@esbuild/win32-x64" package is present but this platform
needs the "@esbuild/win32-arm64" package instead. People often get into this
situation by installing esbuild on Windows or macOS and copying "node_modules"
into a Docker image that runs Linux, or by copying "node_modules" between
Windows and WSL environments.

If you are installing with npm, you can try not copying the "node_modules"
directory when you copy the files over, and running "npm ci" or "npm install"
on the destination platform after the copy. Or you could consider using yarn
instead of npm which has built-in support for installing a package on multiple
platforms simultaneously.

If you are installing with yarn, you can try listing both this platform and the
other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
Keep in mind that this means multiple copies of esbuild will be present.

Another alternative is to use the "esbuild-wasm" package instead, which works
the same way on all platforms. But it comes with a heavy performance cost and
can sometimes be 10x slower than the "esbuild" package, so you may also not
want to do that.

ktos avatar Jan 10 '24 13:01 ktos

@werdnum @ktos Both of these binaries are now downloaded separately during CI so that you'll get the correct ones in pre-release v0.9.8.

I've not been able to test on Linux or Windows, except by making sure that the general process worked for Mac ARM, so if you are seeing some new sort of error please let me know, and probably it can be resolved more quickly.

As for a workaround, it's a bit more involved than would be ideal, and will reset every time you update Continue, but you would need to place the correct version of the esbuild binary at ~/.vscode/extensions/continue.continue-<version>.../out/node_modules/@esbuild/linux-arm64/bin/esbuild.

There are two ways to acquire the binary:

  1. npm install esbuild (version ^0.17.19 is what is in our package.json) and then find the binary at node_modules/@esbuild/linux-arm64/bin/esbuild
  2. https://github.com/evanw/esbuild/blob/main/dl.sh Using curl with the links here

sestinj avatar Jan 11 '24 04:01 sestinj

*small update: download 0.9.8 if you can. There was unfortunate timing with a new binary we are including that I need to solve this same problem for (but don't have the luxury of someone else building for me). Probably going to just move over to some platform other than GitHub actions, so might take a bit before I have the perfect solution for you, but once I do it will hopefully actually be perfect.

Full workaround in this case is to build the extension from source, which roughly looks like this if you're really interested:

git clone https://github.com/continuedev/continue
cd continue/extensions/vscode
node scripts/prepackage.js
node scripts/package.js

and then the .vsix file will be output at continue/extensions/vscode/build/continue-patch.vsix, which in the VS Code file explorer you can right click and at the bottom of the context menu select "Install Extension VSIX"

sestinj avatar Jan 11 '24 08:01 sestinj

*small update: download 0.9.8 if you can. There was unfortunate timing with a new binary we are including that I need to solve this same problem for (but don't have the luxury of someone else building for me). Probably going to just move over to some platform other than GitHub actions, so might take a bit before I have the perfect solution for you, but once I do it will hopefully actually be perfect.

Full workaround in this case is to build the extension from source, which roughly looks like this if you're really interested:

git clone https://github.com/continuedev/continue
cd continue/extensions/vscode
node scripts/prepackage.js
node scripts/package.js

and then the .vsix file will be output at continue/extensions/vscode/build/continue-patch.vsix, which in the VS Code file explorer you can right click and at the bottom of the context menu select "Install Extension VSIX"

I'm trying to build the extension for RHEL 8.9, which version of nodejs is required? And do I need some additional npm packages?

sroecker avatar Jan 12 '24 15:01 sroecker

*small update: download 0.9.8 if you can. There was unfortunate timing with a new binary we are including that I need to solve this same problem for (but don't have the luxury of someone else building for me). Probably going to just move over to some platform other than GitHub actions, so might take a bit before I have the perfect solution for you, but once I do it will hopefully actually be perfect. Full workaround in this case is to build the extension from source, which roughly looks like this if you're really interested:

git clone https://github.com/continuedev/continue
cd continue/extensions/vscode
node scripts/prepackage.js
node scripts/package.js

and then the .vsix file will be output at continue/extensions/vscode/build/continue-patch.vsix, which in the VS Code file explorer you can right click and at the bottom of the context menu select "Install Extension VSIX"

I'm trying to build the extension for RHEL 8.9, which version of nodejs is required? And do I need some additional npm packages?

I've documented my approach here: https://gist.github.com/sroecker/a673776120ca444eabb497f5c8ddd582 I might have missed a few things but with this approach I was able to build the VSCode extension successfully for Red Hat Dev Spaces VSCode 1.84.0. @sestinj FYI

sroecker avatar Jan 15 '24 20:01 sroecker

@sroecker Thanks for sharing this! To answer the node version question, we build with 19.0.0 but other versions should work. I'll add this to CONTRIBUTING.md.

sestinj avatar Jan 15 '24 20:01 sestinj

@sroecker Thanks for sharing this! To answer the node version question, we build with 19.0.0 but other versions should work. I'll add this to CONTRIBUTING.md.

Thanks! I managed to build it with Node.js v18.18.2.

sroecker avatar Jan 15 '24 20:01 sroecker

@werdnum All of the native binaries, esbuild included, are now downloaded in their correct form for each architecture, so Continue should be back to working for linux-arm64. Please let me know if this doesn't seem to be the case!

sestinj avatar Jan 19 '24 22:01 sestinj