I had this issue earlier when trying to deploy but with the exit code 127. I tried changing my npm install to have the production set to false and that ended up just changing the exit code.
failed to fetch an image or build from source: error building: executor failed running [/bin/sh -c npm install && npm run build]: exit code: 126
I’m not sure what to send that would be super helpful with fixing this. I got advice earlier to check my $PATH but I couldn’t find any issues and npm seems accessible.
My docker:
RUN mkdir /app
WORKDIR /app
# NPM will not install any package listed in "devDependencies" when NODE_ENV is set to "production",
# to install all modules: "npm install --production=false".
# Ref: https://docs.npmjs.com/cli/v9/commands/npm-install#description
ENV NODE_ENV production
COPY . .
RUN npm install && npm run build
FROM debian:bullseye
LABEL fly_launch_runtime="nodejs"
COPY --from=builder /root/.volta /root/.volta
COPY --from=builder /app /app
WORKDIR /app
ENV NODE_ENV production
ENV PATH /root/.volta/bin:$PATH
CMD [ "npm", "run", "start" ]
My toml:
app = "fitnesstracking"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
[env]
PORT = "8080"
[experimental]
allowed_public_ports = []
auto_rollback = true
[[services]]
http_checks = []
internal_port = 8080
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"
[[services.ports]]
force_https = true
handlers = ["http"]
port = 80
[[services.ports]]
handlers = ["tls", "http"]
port = 443
[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"