oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.95k stars 2.75k forks source link

error: postinstall script from "esbuild" exited with code 1 (SIGHUP) #7629

Closed sjdonado closed 10 months ago

sjdonado commented 10 months ago

What version of Bun is running?

v1.0.17

What platform is your computer?

Docker oven/bun:1-alpine

What steps can reproduce the bug?

{
  "name": "remix-dashboard",
  "private": true,
  "sideEffects": false,
  "type": "module",
  "dependencies": {
    "@faker-js/faker": "^8.3.1",
    "@heroicons/react": "^2.0.18",
    "@remix-run/css-bundle": "^2.3.1",
    "@remix-run/node": "^2.3.1",
    "@remix-run/react": "^2.3.1",
    "@remix-run/serve": "^2.3.1",
    "@remix-validated-form/with-zod": "^2.0.7",
    "@types/better-sqlite3": "^7.6.8",
    "@types/uuid": "^9.0.7",
    "better-sqlite3": "^9.1.1",
    "clsx": "^2.0.0",
    "daisyui": "4.0.7",
    "drizzle-orm": "^0.29.1",
    "isbot": "^3.6.8",
    "pino": "^8.16.2",
    "pino-pretty": "^10.2.3",
    "playwright": "^1.40.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "remix-auth": "^3.6.0",
    "remix-auth-form": "^1.4.0",
    "remix-toast": "^1.1.0",
    "remix-utils": "^7.1.0",
    "remix-validated-form": "^5.1.5",
    "sonner": "^1.2.2",
    "use-debounce": "^10.0.0",
    "uuid": "^9.0.1",
    "zod": "^3.22.4"
  },
  "devDependencies": {
    "@playwright/test": "^1.40.1",
    "@remix-run/dev": "^2.3.1",
    "@remix-run/eslint-config": "^2.3.1",
    "@types/node": "^20.10.2",
    "@types/react": "^18.2.20",
    "@types/react-dom": "^18.2.7",
    "drizzle-kit": "^0.20.1",
    "eslint": "^8.38.0",
    "tailwindcss": "^3.3.5",
    "typescript": "^5.1.6",
    "vite-tsconfig-paths": "^4.2.1"
  },
  "engines": {
    "node": ">=18.0.0"
  }
}
FROM oven/bun:1-alpine AS base
WORKDIR /usr/src/app

RUN apk update && apk add nodejs

FROM base as install
COPY package.json bun.lockb .
RUN bun install --frozen-lockfile

FROM install AS prerelease
ENV NODE_ENV=production
COPY --from=install /usr/src/app/node_modules node_modules
ADD . .
RUN bun run build

FROM base AS release
ENV NODE_ENV=production
COPY --from=prerelease /usr/src/app .

EXPOSE 3000/tcp
CMD ["bun", "run", "start"]

What is the expected behavior?

image

What do you see instead?

 => CACHED [install 1/2] COPY package.json bun.lockb .                                                                                                                                                                           0.0s
 => ERROR [install 2/2] RUN bun install --frozen-lockfile                                                                                                                                                                       14.9s
------
 > [install 2/2] RUN bun install --frozen-lockfile:
0.129 bun install v1.0.17 (5e60861c)
14.75 node:internal/modules/cjs/loader:1080
14.75   throw err;
14.75   ^
14.75
14.75 Error: Cannot find module '/usr/src/app/install.js'
14.75     at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
14.75     at Module._load (node:internal/modules/cjs/loader:922:27)
14.75     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
14.75     at node:internal/main/run_main_module:23:47 {
14.75   code: 'MODULE_NOT_FOUND',
14.75   requireStack: []
14.75 }
14.75
14.75 Node.js v18.18.2
14.75
14.75 error: postinstall script from "esbuild" exited with code 1 (SIGHUP)

Additional information

No response

sjdonado commented 10 months ago

Temp fix

FROM oven/bun:1-alpine AS base
WORKDIR /usr/src/app

RUN apk update && apk add nodejs npm

FROM base as install
COPY package.json .
RUN npm install

FROM install AS prerelease
ENV NODE_ENV=production
COPY --from=install /usr/src/app/node_modules node_modules
ADD . .
RUN bun run build

FROM base AS release
ENV NODE_ENV=production
COPY --from=prerelease /usr/src/app .

EXPOSE 3000/tcp
CMD ["bun", "run", "start"]
felix-dolderer commented 10 months ago

Can confirm this issue. My temporary fix was to specify bun:1.0.16

ocheezyy-lw commented 10 months ago

Receiving a similar issue with @swc/core:

[Container] 2023/12/13 17:08:32.527158 Running command bun install
--
47 | bun install v1.0.17 (5e60861c)
48 | node:internal/modules/cjs/loader:1031
49 | throw err;
50 | ^
51 |  
52 | Error: Cannot find module '/codebuild/output/src1106935630/src/postinstall.js'
53 | at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1028:15)
54 | at Function.Module._load (node:internal/modules/cjs/loader:873:27)
55 | at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
56 | at node:internal/main/run_main_module:22:47 {
57 | code: 'MODULE_NOT_FOUND',
58 | requireStack: []
59 | }
60 |  
61 | error: postinstall script from "@swc/core" exited with code 1 (SIGHUP)
hunterchainstarters commented 10 months ago

Similar issue with @apollo/protobufjs postinstall:

Sending build context to Docker daemon    599kB
Step 1/21 : FROM oven/bun:1.0.17-alpine as base
1.0.17-alpine: Pulling from oven/bun
c926b61bad3b: Already exists 
3a67a0778a93: Already exists 
110f7de42b09: Already exists 
0e9c81430310: Already exists 
1c5d9b048f10: Already exists 
21c1038c373a: Already exists 
7ae05b609104: Already exists 
Digest: sha256:ca62786f91fdc53f5bc0a5e4e4dd2ac6f956f601af8b5f1c1cdb1706ebfb1cce
Status: Downloaded newer image for oven/bun:1.0.17-alpine
 ---> 28621cfabe11
Step 2/21 : WORKDIR /usr/src/app
 ---> Running in b666f81846c7
Removing intermediate container b666f81846c7
 ---> ae604d87785e
Step 3/21 : FROM base AS install
 ---> ae604d87785e
Step 4/21 : RUN mkdir -p /temp/dev
 ---> Running in 1eeb8dba4451
Removing intermediate container 1eeb8dba4451
 ---> a836c5c6c8ef
Step 5/21 : COPY . /temp/dev/
 ---> 6db2e65e0b68
Step 6/21 : RUN cd /temp/dev && bun install --frozen-lockfile
 ---> Running in f402d5112eb4
[0.03ms] ".env"
bun install v1.0.17 (5e60861c)
error: script not found "scripts/postinstall"

error: postinstall script from "@apollo/protobufjs" exited with code 1 (SIGHUP)

For now I am just going back to 1.0.16

ioitiki commented 10 months ago

Similar issue with @apollo/protobufjs postinstall:

Sending build context to Docker daemon    599kB
Step 1/21 : FROM oven/bun:1.0.17-alpine as base
1.0.17-alpine: Pulling from oven/bun
c926b61bad3b: Already exists 
3a67a0778a93: Already exists 
110f7de42b09: Already exists 
0e9c81430310: Already exists 
1c5d9b048f10: Already exists 
21c1038c373a: Already exists 
7ae05b609104: Already exists 
Digest: sha256:ca62786f91fdc53f5bc0a5e4e4dd2ac6f956f601af8b5f1c1cdb1706ebfb1cce
Status: Downloaded newer image for oven/bun:1.0.17-alpine
 ---> 28621cfabe11
Step 2/21 : WORKDIR /usr/src/app
 ---> Running in b666f81846c7
Removing intermediate container b666f81846c7
 ---> ae604d87785e
Step 3/21 : FROM base AS install
 ---> ae604d87785e
Step 4/21 : RUN mkdir -p /temp/dev
 ---> Running in 1eeb8dba4451
Removing intermediate container 1eeb8dba4451
 ---> a836c5c6c8ef
Step 5/21 : COPY . /temp/dev/
 ---> 6db2e65e0b68
Step 6/21 : RUN cd /temp/dev && bun install --frozen-lockfile
 ---> Running in f402d5112eb4
[0.03ms] ".env"
bun install v1.0.17 (5e60861c)
error: script not found "scripts/postinstall"

error: postinstall script from "@apollo/protobufjs" exited with code 1 (SIGHUP)

For now I am just going back to 1.0.16

I'm having this exact issue.

ioitiki commented 10 months ago

Awesome yeah i can confirm this one is now working for me with v18 :dancers:

sjdonado commented 10 months ago

Still buggy for me, i got this

[+] Building 26.1s (8/12)                                                                                                                                                                                               docker:colima
 => [internal] load build definition from Dockerfile                                                                                                                                                                             0.0s
 => => transferring dockerfile: 443B                                                                                                                                                                                             0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                0.0s
 => => transferring context: 108B                                                                                                                                                                                                0.0s
 => [internal] load metadata for docker.io/oven/bun:1-alpine                                                                                                                                                                     1.2s
 => [internal] load build context                                                                                                                                                                                                0.0s
 => => transferring context: 1.55MB                                                                                                                                                                                              0.0s
 => [base 1/2] FROM docker.io/oven/bun:1-alpine@sha256:f5067895ea6e81362fbcf8481d9f8f2cab5ca1fd2c4924eec5ecc75a1efda89b                                                                                                          9.5s
 => => resolve docker.io/oven/bun:1-alpine@sha256:f5067895ea6e81362fbcf8481d9f8f2cab5ca1fd2c4924eec5ecc75a1efda89b                                                                                                               0.0s
 => => sha256:ab108295191d31a7ba4bf02251449d2d036d347faf7c73d1c1587530b4d86200 1.68kB / 1.68kB                                                                                                                                   0.0s
 => => sha256:2499bbe5831ff871704c5b50bd28915c839e85f395f0c2f12af3df2ae5cd4670 3.62kB / 3.62kB                                                                                                                                   0.0s
 => => sha256:2c03dbb20264f09924f9eab176da44e5421e74a78b09531d3c63448a7baa7c59 3.33MB / 3.33MB                                                                                                                                   0.8s
 => => sha256:4fd116a52c53f75301795babb831a7d00bb293ec058d135a651aa4e33fe844e5 906.27kB / 906.27kB                                                                                                                               1.0s
 => => sha256:f5067895ea6e81362fbcf8481d9f8f2cab5ca1fd2c4924eec5ecc75a1efda89b 685B / 685B                                                                                                                                       0.0s
 => => sha256:86d0ff57b65ca4439e55096f87a412af04e6e2255d1dad295897aae4e4f9c904 5.61MB / 5.61MB                                                                                                                                   1.9s
 => => sha256:13c18312a5b30e189a8e19793a91309e7f3270c634e6408ce8eb24d231423794 34.11MB / 34.11MB                                                                                                                                 8.7s
 => => extracting sha256:2c03dbb20264f09924f9eab176da44e5421e74a78b09531d3c63448a7baa7c59                                                                                                                                        0.1s
 => => sha256:db097f2255358e4e6b36bc9ad2590db0e02f4d8371c36a274d1d43fdceb8dbcc 295B / 295B                                                                                                                                       1.5s
 => => sha256:d4b4c10fcb46fb4f0beae0cf8c37487908ae9446545d39db4e9e39aa60dae6bf 6.63MB / 6.63MB                                                                                                                                   4.7s
 => => extracting sha256:86d0ff57b65ca4439e55096f87a412af04e6e2255d1dad295897aae4e4f9c904                                                                                                                                        0.1s
 => => extracting sha256:4fd116a52c53f75301795babb831a7d00bb293ec058d135a651aa4e33fe844e5                                                                                                                                        0.0s
 => => sha256:ecad3b9faaba88d21e931e5633685cb307e2a689ae41a6cfd36317b95c84f103 145B / 145B                                                                                                                                       2.6s
 => => extracting sha256:13c18312a5b30e189a8e19793a91309e7f3270c634e6408ce8eb24d231423794                                                                                                                                        0.5s
 => => extracting sha256:db097f2255358e4e6b36bc9ad2590db0e02f4d8371c36a274d1d43fdceb8dbcc                                                                                                                                        0.0s
 => => extracting sha256:d4b4c10fcb46fb4f0beae0cf8c37487908ae9446545d39db4e9e39aa60dae6bf                                                                                                                                        0.1s
 => => extracting sha256:ecad3b9faaba88d21e931e5633685cb307e2a689ae41a6cfd36317b95c84f103                                                                                                                                        0.0s
 => [base 2/2] WORKDIR /usr/src/app                                                                                                                                                                                              0.0s
 => [install 1/2] COPY package.json bun.lockb .                                                                                                                                                                                  0.0s
 => ERROR [install 2/2] RUN bun install --frozen-lockfile                                                                                                                                                                       15.4s
------
 > [install 2/2] RUN bun install --frozen-lockfile:
0.146 bun install v1.0.18 (36c316a2)
15.28 error: Module not found "/usr/src/app/install.js"
15.28 
15.28 error: postinstall script from "esbuild" exited with code 1 (SIGHUP)
------
Dockerfile:6
--------------------
   4 |     FROM base as install
   5 |     COPY package.json bun.lockb .
   6 | >>> RUN bun install --frozen-lockfile
   7 |     
   8 |     FROM install AS prerelease
--------------------
ERROR: failed to solve: process "/bin/sh -c bun install --frozen-lockfile" did not complete successfully: exit code: 1
aludvigsen commented 9 months ago

I have the same problem. I think it's the same issue as in #7626. The postinstall script is being run from the wrong folder. It works fine in v1.0.16

Edit: I think it's related to #7517 aswell.

muuvmuuv commented 4 months ago

Also getting this with SIGKILL in GitLab CI. Anything I can do to provide more details?

Using docker image sha256:0cec42f07333c446df69643cdd3e6b7ae531240d86d9bab3c8f20f99f95d9006 for oven/bun:1.1.17 with digest oven/bun@sha256:7b5c05b562efbbec704df426a9eef18f3b935bdc868678895a935bf120bda062 ...
$ bun install --concurrent-scripts=1
bun install v1.1.17 (bb66bba1)
Resolving dependencies
Resolved, downloaded and extracted [2]
error: postinstall script from "esbuild" terminated by SIGKILL (Forced quit)
/bin/bash: line 150:    15 Killed                  bun install --concurrent-scripts=1
viiccwen commented 3 months ago

Receiving a similar issue with @swc/core:

[Container] 2023/12/13 17:08:32.527158 Running command bun install
--
47 | bun install v1.0.17 (5e60861c)
48 | node:internal/modules/cjs/loader:1031
49 | throw err;
50 | ^
51 |  
52 | Error: Cannot find module '/codebuild/output/src1106935630/src/postinstall.js'
53 | at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1028:15)
54 | at Function.Module._load (node:internal/modules/cjs/loader:873:27)
55 | at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
56 | at node:internal/main/run_main_module:22:47 {
57 | code: 'MODULE_NOT_FOUND',
58 | requireStack: []
59 | }
60 |  
61 | error: postinstall script from "@swc/core" exited with code 1 (SIGHUP)

using bun update at first.

> bun update
> bun install