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

Failed to spawn script postinstall due to error os.linux.errno.generic.E.PERM #8020

Open 4Furki4 opened 9 months ago

4Furki4 commented 9 months ago

What version of Bun is running?

1.0.20

What platform is your computer?

Linux 5.15.133.1-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

I cannot install node packages using bun install even though npm install works.

The other problem is that even though I install packages with npm i, bun run dev doesn't even boot my Next.js project.

To reproduce the bug, create a next project and try to install packages or run the project.

What is the expected behavior?

bun install should've installed node packages and bun run dev should've run my project like npm install and npm run dev do

What do you see instead?

The error I receive in the terminal when I run bun install: image It gets stuck on installing bycrypt.

when I run bun run dev (packages installed using npm install) image

Additional information

I reset my laptop a couple of days ago, Bun was running as expected before the reset. None of my configs changed. I'm still using the same version of Bun and WSL. Node version is v20.10.0 npm version is 10.2.3 WSL version is 2.0.9.0

4Furki4 commented 9 months ago

I noticed that reinstalling Bun using npm install -g bun solved the issue. I can install packages and run my applications with Bun. However, installing Bun using curl -fsSL https://bun.sh/install | bash still doesn't work.

alinjie commented 9 months ago

I'm running into the same issue while trying to build my Docker file using Docker-in-Docker (dind). My setup:

Dockerfile

FROM oven/bun:1 as builder
WORKDIR /app
COPY . .
RUN bun install
RUN bun run build

Outcome

#9 [5/6] RUN bun install
#9 0.376 bun install v1.0.25 (a8ff7be6)
#9 3.388 error: Failed to spawn script postinstall due to error os.linux.errno.generic.E.PERM PERM
#9 3.487 error: Failed to spawn script install due to error os.linux.errno.generic.E.PERM PERM

I'm using docker:24-dind and docker:24 to build.

This error occurs while running build on a GitLab Runner (running Linux). I tried the same setup in macOS 14.2 (also using dind), which worked fine.

alinjie commented 9 months ago

More context: bun install --verbose shows that it's @swc/core's post install script and msgpackr-extract's install script that are failing

ademola-lou commented 8 months ago

I am having the same issue, I am using wsl on windows

Anyone able to resolve this yet?

[Edit]- I was able to resolve this, I just needed to upgrade bun (1.0.26), and node version (make sure node version is at least > 14.), also bun depends on unzip (make sure it's in PATH), while in wsl shell you might need to do source ~/.bashrc

jscul commented 6 months ago

For some reason this issue started popping up for me whenever a package has a postinstall script in the package.json. I can confirm this issue is still ongoing on Ubuntu.