Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sotamota's avatar

npm error when installing laravel 10 on docker ubuntu

Hello.

During the installation stage of a new laravel 10 project, a failure occurs and errors appear in the terminal:

502.6 26 packages are looking for funding 502.6 run npm fund for details 507.1 507.1 added 1 package in 4s 507.1 507.1 1 package is looking for funding 507.1 run npm fund for details 535.0 npm ERR! code 1 535.0 npm ERR! path /usr/lib/node_modules/bun 535.0 npm ERR! command failed 535.0 npm ERR! command sh -c node install.js 535.0 npm ERR! Failed to find package "..../bun-linux-x64-baseline". You may have used the "--no-optional" flag when running "npm install". 535.0 npm ERR! Error: Failed to install package "bun" 535.0 npm ERR! at /usr/lib/node_modules/bun/install.js:311:11 535.0 npm ERR! at Generator.throw () 535.0 npm ERR! at rejected (/usr/lib/node_modules/bun/install.js:35:27) 535.0 npm ERR! at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 535.0 535.0 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-11-06T09_00_52_538Z-debug-0.log

The problem occurs precisely when installing laravel with the command curl -s h...s://laravel.build/project name | bash without manual installation and assembly

Versions: Docker version 24.0.7 Docker Compose version v2.23.0 Ubuntu 22.04.3 LTS

How to overcome this problem?

0 likes
5 replies
sotamota's avatar

Am I the only one having this problem?

Previously, I created several projects in the same environment and everything was ok

KalimeroMK's avatar
Level 41

The error you're encountering seems to be related to the installation of a package named bun via npm. This issue can occur due to a variety of reasons, such as compatibility issues, incorrect npm package versions, or problems with the specific package being installed. Here are some steps to troubleshoot and potentially resolve the problem:

pls shere dockerfile

sotamota's avatar

@KalimeroMK

Contents of the dockerfile, it is now being picked up by docker-compose.yml (these are laravel files, i didn't compile them):

FROM ubuntu:22.04

LABEL maintainer="Taylor Otwell"

ARG WWWGROUP ARG NODE_VERSION=20 ARG POSTGRES_VERSION=15

WORKDIR /var/www/html

ENV DEBIAN_FRONTEND noninteractive ENV TZ=UTC

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apt-get update && mkdir -p /etc/apt/keyrings && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils librsvg2-bin fswatch && curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null && echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] h...s://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list && apt-get update && apt-get install -y php8.2-cli php8.2-dev php8.2-pgsql php8.2-sqlite3 php8.2-gd php8.2-imagick php8.2-curl php8.2-imap php8.2-mysql php8.2-mbstring php8.2-xml php8.2-zip php8.2-bcmath php8.2-soap php8.2-intl php8.2-readline php8.2-ldap php8.2-msgpack php8.2-igbinary php8.2-redis php8.2-swoole php8.2-memcached php8.2-pcov php8.2-xdebug && curl -sLS h...s://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer && curl -fsSL h...s://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] h...s://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" > /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install -y nodejs && npm install -g npm && npm install -g pnpm && npm install -g bun && curl -sS h...s://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /etc/apt/keyrings/yarn.gpg >/dev/null && echo "deb [signed-by=/etc/apt/keyrings/yarn.gpg] h...s://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && curl -sS h...s://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg >/dev/null && echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] h..p://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list && apt-get update && apt-get install -y yarn && apt-get install -y mysql-client && apt-get install -y postgresql-client-$POSTGRES_VERSION && apt-get -y autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.2

RUN groupadd --force -g $WWWGROUP sail RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail

COPY start-container /usr/local/bin/start-container COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY php.ini /etc/php/8.2/cli/conf.d/99-sail.ini RUN chmod +x /usr/local/bin/start-container

EXPOSE 8000

ENTRYPOINT ["start-container"]

sotamota's avatar

I still haven't found a solution... In theory, everything should be installed out of the box

sotamota's avatar

Просто удалил установку bun из dockerfile laravel и все заработало, я не понимаю почему эта штука не устанавливалась и почему ее плохо протестила команда разработчиков laravel, добавляя в официальный dockerfile.

Как гласит википедиа, это среда выполнения js, менеджер пакетов и установщик тестов, пришедший на замену nodejs. Релиз состоялся в сентябре 2023 года. Незнаю... Мне не зашло...

Please or to participate in this conversation.