Skip to content

Instantly share code, notes, and snippets.

@timriley
Created November 14, 2024 22:26
Show Gist options
  • Save timriley/97fb57fc9ace630ed15cdffb89bfb519 to your computer and use it in GitHub Desktop.
Save timriley/97fb57fc9ace630ed15cdffb89bfb519 to your computer and use it in GitHub Desktop.
Error with esbuild architecture and buildpacks with Hanami 2.2
❯ pack build hanami-site --path .
24: Pulling from heroku/builder
Digest: sha256:05cd9612b9250d1f5ff38cedf36507e4f1c114f58f25005d246494a3cf83c09c
Status: Image is up to date for heroku/builder:24
24: Pulling from heroku/heroku
Digest: sha256:0dd9605531132c0dbb265d96f6e041f241c8fc596b46c584dd98c2c5ed3bf226
Status: Image is up to date for heroku/heroku:24
===> ANALYZING
Image with name "hanami-site" not found
===> DETECTING
2 of 6 buildpacks participating
heroku/nodejs-engine 3.3.2
heroku/ruby 3.0.0
===> RESTORING
===> BUILDING
[Heroku Node.js Engine Buildpack]
[Checking Node.js version]
Node.js version not specified, using 22.x
Resolved Node.js version: 22.11.0
[Installing Node.js distribution]
Downloading Node.js 22.11.0 (linux-arm64) from https://nodejs.org/download/release/v22.11.0/node-v22.11.0-linux-arm64.tar.gz
Verifying checksum
Extracting Node.js 22.11.0 (linux-arm64)
Installing Node.js 22.11.0 (linux-arm64)
Installing application metrics scripts
# Heroku Ruby Buildpack
- Metrics agent
- Skipping install (`barnes` gem not found)
- Ruby version `3.3.6` from `Gemfile.lock`
- Installing ...................... (19.240s)
- Bundler version `2.5.23` from `Gemfile.lock`
- Running `gem install bundler --version 2.5.23` ... (0.623s)
- Bundle install
- Running `BUNDLE_BIN="/layers/heroku_ruby/gems/bin" BUNDLE_CLEAN="1" BUNDLE_DEPLOYMENT="1" BUNDLE_GEMFILE="/workspace/Gemfile" BUNDLE_PATH="/layers/heroku_ruby/gems" BUNDLE_WITHOUT="development:test" bundle install`
Fetching gem metadata from https://rubygems.org/.........
Fetching rake 13.2.1
Installing rake 13.2.1
Fetching bigdecimal 3.1.8
Fetching coderay 1.1.3
Fetching concurrent-ruby 1.3.4
Fetching diff-lcs 1.5.1
Fetching logger 1.6.1
Fetching zeitwerk 2.7.1
Fetching dry-cli 1.2.0
Fetching dry-files 1.1.0
Fetching dry-inflector 1.1.0
Fetching dry-initializer 3.1.1
Installing bigdecimal 3.1.8 with native extensions
Installing coderay 1.1.3
Fetching dry-logger 1.0.4
Installing concurrent-ruby 1.3.4
Installing diff-lcs 1.5.1
Installing logger 1.6.1
Fetching ice_nine 0.11.2
Installing zeitwerk 2.7.1
Installing dry-cli 1.2.0
Installing dry-files 1.1.0
Fetching ffi 1.17.0 (aarch64-linux-gnu)
Fetching formatador 1.1.0
Fetching rb-fsevent 0.11.2
Fetching lumberjack 1.2.10
Fetching nenv 0.3.0
Installing dry-inflector 1.1.0
Fetching shellany 0.0.1
Installing dry-initializer 3.1.1
Fetching method_source 1.1.0
Installing dry-logger 1.0.4
Fetching thor 1.3.2
Installing ice_nine 0.11.2
Fetching guard-compat 1.2.1
Installing formatador 1.1.0
Fetching nio4r 2.7.4
Installing ffi 1.17.0 (aarch64-linux-gnu)
Installing rb-fsevent 0.11.2
Installing lumberjack 1.2.10
Fetching json 2.8.2
Installing nenv 0.3.0
Installing shellany 0.0.1
Installing method_source 1.1.0
Fetching rack 2.2.10
Fetching transproc 1.1.1
Fetching ruby2_keywords 0.0.5
Installing thor 1.3.2
Installing guard-compat 1.2.1
Fetching hansi 0.2.1
Fetching rspec-support 3.13.1
Fetching temple 0.10.3
Fetching tilt 2.4.0
Installing nio4r 2.7.4 with native extensions
Installing json 2.8.2 with native extensions
Installing rack 2.2.10
Installing transproc 1.1.1
Fetching sqlite3 2.2.0 (aarch64-linux-gnu)
Installing ruby2_keywords 0.0.5
Fetching dry-transformer 1.0.1
Fetching hanami-assets 2.2.0
Installing hansi 0.2.1
Fetching dry-core 1.0.2
Installing rspec-support 3.13.1
Fetching hanami-cli 2.2.1
Installing temple 0.10.3
Fetching rb-inotify 0.11.1
Installing tilt 2.4.0
Fetching notiffany 0.1.3
Installing dry-transformer 1.0.1
Fetching pry 0.14.2
Installing hanami-assets 2.2.0
Fetching mustermann 3.0.3
Installing dry-core 1.0.2
Installing sqlite3 2.2.0 (aarch64-linux-gnu)
Installing hanami-cli 2.2.1
Installing rb-inotify 0.11.1
Installing notiffany 0.1.3
Fetching rspec-core 3.13.2
Fetching rspec-expectations 3.13.3
Fetching rspec-mocks 3.13.2
Installing pry 0.14.2
Fetching dry-auto_inject 1.0.1
Installing mustermann 3.0.3
Fetching dry-configurable 1.2.0
Fetching dry-events 1.0.1
Installing rspec-core 3.13.2
Installing rspec-expectations 3.13.3
Installing dry-auto_inject 1.0.1
Installing rspec-mocks 3.13.2
Installing dry-configurable 1.2.0
Fetching dry-logic 1.5.0
Fetching dry-monads 1.6.0
Fetching hanami-utils 2.2.0
Fetching listen 3.9.0
Fetching mustermann-contrib 3.0.3
Fetching dry-system 1.1.1
Installing dry-events 1.0.1
Fetching hanami-view 2.2.0
Installing dry-logic 1.5.0
Fetching rspec 3.13.0
Installing dry-monads 1.6.0
Fetching dry-monitor 1.0.1
Installing hanami-utils 2.2.0
Fetching dry-operation 1.0.0
Installing listen 3.9.0
Fetching hanami-controller 2.2.0
Installing mustermann-contrib 3.0.3
Fetching guard 2.19.0
Installing dry-system 1.1.1
Fetching hanami-router 2.2.0
Installing hanami-view 2.2.0
Installing rspec 3.13.0
Fetching hanami-rspec 2.2.1
Installing dry-monitor 1.0.1
Installing dry-operation 1.0.0
Installing hanami-controller 2.2.0
Installing guard 2.19.0
Installing hanami-router 2.2.0
Installing hanami-rspec 2.2.1
Fetching hanami 2.2.1
Installing hanami 2.2.1
Fetching puma 6.4.3
Installing puma 6.4.3 with native extensions
Fetching guard-puma 0.8.1
Installing guard-puma 0.8.1
Fetching hanami-reloader 2.2.0
Installing hanami-reloader 2.2.0
Fetching sequel 5.86.0
Fetching dry-types 1.7.2
Installing dry-types 1.7.2
Installing sequel 5.86.0
Fetching dry-schema 1.13.4
Fetching dry-struct 1.6.0
Installing dry-schema 1.13.4
Fetching dry-validation 1.10.0
Installing dry-struct 1.6.0
Fetching rom-core 5.3.2
Installing dry-validation 1.10.0
Fetching hanami-validations 2.2.0
Installing rom-core 5.3.2
Installing hanami-validations 2.2.0
Fetching rom-repository 5.3.0
Fetching rom-changeset 5.3.0
Installing rom-repository 5.3.0
Installing rom-changeset 5.3.0
Fetching rom 5.3.2
Installing rom 5.3.2
Fetching rom-sql 3.6.4
Installing rom-sql 3.6.4
Fetching hanami-db 2.2.0
Installing hanami-db 2.2.0
Bundle complete! 19 Gemfile dependencies, 77 gems now installed.
Gems in the groups 'development' and 'test' were not installed.
Bundled gems are installed into `/layers/heroku_ruby/gems`
2 installed gems you directly depend on are looking for funding.
Run `bundle fund` for details
- Done (11.687s)
- Setting default processes
- Running `bundle list` ... (0.109s)
- Detected rack app (`rack` gem found and `config.ru` at root of application)
- Rake assets install
- Detected rake (`rake` gem found, `Rakefile` found at `/workspace/Rakefile`)
- Running `bundle exec rake -P --trace` ... (0.413s)
- Compiling assets without cache (Clean task not found via `bundle exec rake -P`)
- ! HELP Enable caching by ensuring `rake assets:clean` is present when running the detect command locally
- Running `bundle exec rake assets:precompile --trace`
** Invoke assets:precompile (first_time)
** Execute assets:precompile
[site] /workspace/node_modules/esbuild/lib/main.js:1910
[site] throw new Error(`
[site] ^
[site]
[site] Error:
[site] You installed esbuild for another platform than the one you're currently using.
[site] This won't work because esbuild is written with native code and needs to
[site] install a platform-specific binary executable.
[site]
[site] Specifically the "@esbuild/darwin-arm64" package is present but this platform
[site] needs the "@esbuild/linux-arm64" package instead. People often get into this
[site] situation by installing esbuild on Windows or macOS and copying "node_modules"
[site] into a Docker image that runs Linux, or by copying "node_modules" between
[site] Windows and WSL environments.
[site]
[site] If you are installing with npm, you can try not copying the "node_modules"
[site] directory when you copy the files over, and running "npm ci" or "npm install"
[site] on the destination platform after the copy. Or you could consider using yarn
[site] instead of npm which has built-in support for installing a package on multiple
[site] platforms simultaneously.
[site]
[site] If you are installing with yarn, you can try listing both this platform and the
[site] other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
[site] feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
[site] Keep in mind that this means multiple copies of esbuild will be present.
[site]
[site] Another alternative is to use the "esbuild-wasm" package instead, which works
[site] the same way on all platforms. But it comes with a heavy performance cost and
[site] can sometimes be 10x slower than the "esbuild" package, so you may also not
[site] want to do that.
[site]
[site] at generateBinPath (/workspace/node_modules/esbuild/lib/main.js:1910:17)
[site] at esbuildCommandAndArgs (/workspace/node_modules/esbuild/lib/main.js:1991:33)
[site] at ensureServiceIsRunning (/workspace/node_modules/esbuild/lib/main.js:2162:25)
[site] at Object.build (/workspace/node_modules/esbuild/lib/main.js:2047:26)
[site] at Module.run (file:///workspace/node_modules/hanami-assets/dist/index.js:26:23)
[site] at file:///workspace/config/assets.js:3:14
[site] at ModuleJob.run (node:internal/modules/esm/module_job:268:25)
[site] at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:543:26)
[site] at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)
[site]
[site] Node.js v22.11.0
- Done (0.573s)
- Done (finished in 32.703s)
===> EXPORTING
Adding layer 'heroku/nodejs-engine:dist'
Adding layer 'heroku/nodejs-engine:node_runtime_metrics'
Adding layer 'heroku/nodejs-engine:web_env'
Adding layer 'heroku/ruby:bundler'
Adding layer 'heroku/ruby:env_defaults'
Adding layer 'heroku/ruby:gems'
Adding layer 'heroku/ruby:ruby'
Adding layer 'buildpacksio/lifecycle:launch.sbom'
Added 1/1 app layer(s)
Adding layer 'buildpacksio/lifecycle:launcher'
Adding layer 'buildpacksio/lifecycle:config'
Adding layer 'buildpacksio/lifecycle:process-types'
Adding label 'io.buildpacks.lifecycle.metadata'
Adding label 'io.buildpacks.build.metadata'
Adding label 'io.buildpacks.project.metadata'
Setting default process type 'web'
Saving hanami-site...
*** Images (5443938e03a1):
hanami-site
Adding cache layer 'heroku/nodejs-engine:dist'
Adding cache layer 'heroku/ruby:bundler'
Adding cache layer 'heroku/ruby:gems'
Adding cache layer 'heroku/ruby:ruby'
Successfully built image hanami-site
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment