Skip to content

In bun 1.3.4, sharp paackage is failing at build #25395

@iajaysharma

Description

@iajaysharma

What version of Bun is running?

1.3.4

What platform is your computer?

No response

What steps can reproduce the bug?

115 | } 116 | help.push( 117 | '- Consult the installation documentation:', 118 | ' See https://sharp.pixelplumbing.com/install' 119 | ); 120 | throw new Error(help.join('\n')); ^ error: Could not load the "sharp" module using the linux-arm64 runtime Possible solutions: - Ensure optional dependencies can be installed: npm install --include=optional sharp - Ensure your package manager supports multi-platform installation: See https://sharp.pixelplumbing.com/install#cross-platform - Add platform-specific dependencies: npm install --os=linux --cpu=arm64 sharp - Consult the installation documentation: See https://sharp.pixelplumbing.com/install at (node_modules/sharp/lib/sharp.js:120:13) at (/$bunfs/root/myapp:2:353) at (node_modules/sharp/lib/constructor.js:8:7) at (/$bunfs/root/myapp:2:353) at (node_modules/sharp/lib/index.js:6:7) at (/$bunfs/root/myapp:2:353) at api/src/routes/admin/category.route.ts:5:1 at loadAndEvaluateModule (2:1) Bun v1.3.4 (Linux arm64) 115 | } 116 | help.push( 117 | '- Consult the installation documentation:', 118 | ' See https://sharp.pixelplumbing.com/install' 119 | ); 120 | throw new Error(help.join('\n')); ^ error: Could not load the "sharp" module using the linux-arm64 runtime Possible solutions: - Ensure optional dependencies can be installed: npm install --include=optional sharp - Ensure your package manager supports multi-platform installation: See https://sharp.pixelplumbing.com/install#cross-platform - Add platform-specific dependencies: npm install --os=linux --cpu=arm64 sharp - Consult the installation documentation: See https://sharp.pixelplumbing.com/install at (node_modules/sharp/lib/sharp.js:120:13) at (/$bunfs/root/myapp:2:353) at (node_modules/sharp/lib/constructor.js:8:7) at (/$bunfs/root/myapp:2:353) at (node_modules/sharp/lib/index.js:6:7) at (/$bunfs/root/myapp:2:353) at api/src/routes/admin/category.route.ts:5:1 at loadAndEvaluateModule (2:1) Bun v1.3.4 (Linux arm64) 115 | } 116 | help.push( 117 | '- Consult the installation documentation:', 118 | ' See https://sharp.pixelplumbing.com/install' 119 | ); 120 | throw new Error(help.join('\n')); ^ error: Could not load the "sharp" module using the linux-arm64 runtime Possible solutions: - Ensure optional dependencies can be installed: npm install --include=optional sharp - Ensure your package manager supports multi-platform installation: See https://sharp.pixelplumbing.com/install#cross-platform - Add platform-specific dependencies: npm install --os=linux --cpu=arm64 sharp - Consult the installation documentation: See https://sharp.pixelplumbing.com/install at (node_modules/sharp/lib/sharp.js:120:13) at (/$bunfs/root/myapp:2:353) at (node_modules/sharp/lib/constructor.js:8:7) at (/$bunfs/root/myapp:2:353) at (node_modules/sharp/lib/index.js:6:7) at (/$bunfs/root/myapp:2:353) at api/src/routes/admin/category.route.ts:5:1 at loadAndEvaluateModule (2:1) Bun v1.3.4 (Linux arm64) 115 | } 116 | help.push( 117 | '- Consult the installation documentation:', 118 | ' See https://sharp.pixelplumbing.com/install' 119 | ); 120 | throw new Error(help.join('\n')); ^ error: Could not load the "sharp" module using the linux-arm64 runtime Possible solutions: - Ensure optional dependencies can be installed: npm install --include=optional sharp - Ensure your package manager supports multi-platform installation: See https://sharp.pixelplumbing.com/install#cross-platform - Add platform-specific dependencies: npm install --os=linux --cpu=arm64 sharp - Consult the installation documentation: See https://sharp.pixelplumbing.com/install at (node_modules/sharp/lib/sharp.js:120:13) at (/$bunfs/root/myapp:2:353) at (node_modules/sharp/lib/constructor.js:8:7) at (/$bunfs/root/myapp:2:353) at (node_modules/sharp/lib/index.js:6:7) at (/$bunfs/root/myapp:2:353) at api/src/routes/admin/category.route.ts:5:1 at loadAndEvaluateModule (2:1) Bun v1.3.4 (Linux arm64) 115 | } 116 | help.push( 117 | '- Consult the installation documentation:', 118 | ' See https://sharp.pixelplumbing.com/install' 119 | ); 120 | throw new Error(help.join('\n')); ^ error: Could not load the "sharp" module using the linux-arm64 runtime Possible solutions: - Ensure optional dependencies can be installed: npm install --include=optional sharp - Ensure your package manager supports multi-platform installation: See https://sharp.pixelplumbing.com/install#cross-platform - Add platform-specific dependencies: npm install --os=linux --cpu=arm64 sharp - Consult the installation documentation: See https://sharp.pixelplumbing.com/install at (node_modules/sharp/lib/sharp.js:120:13) at (/$bunfs/root/myapp:2:353) at (node_modules/sharp/lib/constructor.js:8:7) at (/$bunfs/root/myapp:2:353) at (node_modules/sharp/lib/index.js:6:7) at (/$bunfs/root/myapp:2:353) at api/src/routes/admin/category.route.ts:5:1 at loadAndEvaluateModule (2:1) Bun v1.3.4 (Linux arm64) 115 | } 116 | help.push( 117 | '- Consult the installation documentation:', 118 | ' See https://sharp.pixelplumbing.com/install' 119 | ); 120 | throw new Error(help.join('\n')); ^ error: Could not load the "sharp" module using the linux-arm64 runtime Possible solutions: - Ensure optional dependencies can be installed: npm install --include=optional sharp - Ensure your package manager supports multi-platform installation: See https://sharp.pixelplumbing.com/install#cross-platform - Add platform-specific dependencies: npm install --os=linux --cpu=arm64 sharp - Consult the installation documentation: See https://sharp.pixelplumbing.com/install at (node_modules/sharp/lib/sharp.js:120:13) at (/$bunfs/root/myapp:2:353) at (node_modules/sharp/lib/constructor.js:8:7) at (/$bunfs/root/myapp:2:353) at (node_modules/sharp/lib/index.js:6:7) at (/$bunfs/root/myapp:2:353) at api/src/routes/admin/category.route.ts:5:1 at loadAndEvaluateModule (2:1) Bun v1.3.4 (Linux arm64) 115 | } 116 | help.push( 117 | '- Consult the installation documentation:', 118 | ' See https://sharp.pixelplumbing.com/install' 119 | ); 120 | throw new Error(help.join('\n')); ^ error: Could not load the "sharp" module using the linux-arm64 runtime Possible solutions: - Ensure optional dependencies can be installed: npm install --include=optional sharp - Ensure your package manager supports multi-platform installation: See https://sharp.pixelplumbing.com/install#cross-platform - Add platform-specific dependencies: npm install --os=linux --cpu=arm64 sharp - Consult the installation documentation: See https://sharp.pixelplumbing.com/install at (node_modules/sharp/lib/sharp.js:120:13) at (/$bunfs/root/myapp:2:353) at (node_modules/sharp/lib/constructor.js:8:7) at (/$bunfs/root/myapp:2:353) at (node_modules/sharp/lib/index.js:6:7) at (/$bunfs/root/myapp:2:353) at api/src/routes/admin/category.route.ts:5:1 at loadAndEvaluateModule (2:1) Bun v1.3.4 (Linux arm64) 115 | } 116 | help.push( 117 | '- Consult the installation documentation:', 118 | ' See https://sharp.pixelplumbing.com/install' 119 | ); 120 | throw new Error(help.join('\n')); ^ error: Could not load the "sharp" module using the linux-arm64 runtime Possible solutions: - Ensure optional dependencies can be installed: npm install --include=optional sharp - Ensure your package manager supports multi-platform installation: See https://sharp.pixelplumbing.com/install#cross-platform - Add platform-specific dependencies: npm install --os=linux --cpu=arm64 sharp - Consult the installation documentation: See https://sharp.pixelplumbing.com/install at (node_modules/sharp/lib/sharp.js:120:13) at (/$bunfs/root/myapp:2:353) at (node_modules/sharp/lib/constructor.js:8:7) at (/$bunfs/root/myapp:2:353) at (node_modules/sharp/lib/index.js:6:7) at (/$bunfs/root/myapp:2:353) at api/src/routes/admin/category.route.ts:5:1 at loadAndEvaluateModule (2:1) Bun v1.3.4 (Linux arm64) suddenly the bun build failing

In version 1.3.3 its working as expected.

What is the expected behavior?

Stage 1: Build

FROM oven/bun:1.3.3 AS build

WORKDIR /app

Copy only package files first for better caching

COPY ../package.json ./

Install dependencies

RUN bun install

Now copy the rest of the source files

COPY ../ .

ENV NODE_ENV=production

Compile the app

RUN bun build --compile --minify --sourcemap ./api/src/index.ts --outfile myapp --external cloudflare:workers

Set environment (optional)

EXPOSE 8080

CMD ["./myapp"]

above is the working Docckerfile but if we switch to 1.3.4, it will start failing due to sharp package

What do you see instead?

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions