Sitelet https://github.com/nodejs/docker-node/issues/1912
Skip to content

Node 20.3.0 images give error /usr/bin/env: 'node': Text file busy #1912

Description

@culli

Environment

  • Platform: macos 13.4 M1
  • Docker Version: 24.0.2
  • Node.js Version: 20.3.0
  • Image Tag: node:20-alpine3.17

Expected Behavior

yarn tsc should run correctly

Current Behavior

 > [service 5/5] RUN yarn build:
#0 0.298 yarn run v1.22.19
#0 0.314 $ tsc
#0 0.325 /usr/bin/env: 'node': Text file busy
#0 0.334 error Command failed with exit code 126.

Possible Solution

downgrade to node:20-alpine3.16 (or node:20.2.0-bullseye-slim)

Steps to Reproduce

dockerfile:

FROM node:20-alpine3.17 as install
WORKDIR /service
COPY ./service ./
RUN yarn install --frozen-lockfile
RUN yarn build

yarn build creates a directory, compiles some protobuf, then execs tsc (bin from typescript dependency)

Additional Information

Things work correctly on 3.16, but give the text file busy error with 3.17 and 3.18. Also tried bullseye-slim and node:20.3.0-bullseye-slim gives the same error, but 20.2.0 works correctly.

Maybe this is an architecture mismatch or file permissions problem?

Activity

  1. culli commented on Jun 12, 2023

    @culli
    Author

    I can provide a more complete repro node project if that is needed.

  2. danlordan commented on Jun 13, 2023

    @danlordan

    +1, getting an issue on this as well, had to switch to node:18 to get builds to run, instead of node:latest

  3. Eeemil commented on Jun 14, 2023

    @Eeemil

    A colleague of mine running a Mac M1 has the same issue, but it works for me on PC (Ubuntu). Might be an issue for Mac M1 only.

  4. egl74 commented on Jun 14, 2023

    @egl74

    Can (temporarily) be fixed by using OrbStack instead of Docker for Mac

  5. mfn commented on Jun 14, 2023

    @mfn

    Same here with node:20.3-slim running in Docker Desktop 4.20.1 on macOS 13.4 Apple Silicon.

    Reverting to node:20.2-slim worked.

    Only affected shell/bash scripts trying to start node (e.g. yarn start in a NextJS project), when I ran it manually it worked.

    Only saw this on local dev and not pro container (but prod != ARM, so… 🤷🏼 )

  6. yann1731 commented on Jun 14, 2023

    @yann1731

    A colleague of mine running a Mac M1 has the same issue, but it works for me on PC (Ubuntu). Might be an issue for Mac M1 only.

    Can confirm I got this issue on M1 mac and Pop!_os

  7. bjonnh-work commented on Jun 14, 2023

    @bjonnh-work

    This is breaking in docker on x86 as well as M1 for us, and we get the same error on containers that start yarn.

  8. book000 commented on Jun 14, 2023

    @book000

    This issue was also observed in the following environments:

    • Windows 10 22H2 (Build 19045.2965)
    • CPU: AMD Ryzen 9 5900X (x86_64)
    • Docker Desktop 4.19.0 (106363)
    • Image tag: node:20-alpine
    • Package manager: Yarn

    It is not limited to a specific Node.js project, but occurs in all projects that use node:20-alpine. I have confirmed that replacing it with node:18-alpine works.


    However, this problem does not occur in the following environments:

    • Ubuntu 22.04.2 LTS
    • CPU: Intel Core i7-6700 (x86_64)
    • Docker 24.0.2
  9. jerlendds commented on Jun 15, 2023

    @jerlendds

    This can be recreated in my project from commit b76bc9b with the frontend Dockerfile but I have since pushed this version: node:18-alpine.

    Seemingly related: Docker forums
    My related issue with more details can be found here: jerlendds/osintbuddy#49

  10. evanw commented on Jun 15, 2023

    @evanw

    FYI there is another case of people hitting this problem here: evanw/esbuild#3156.

  11. JoostK commented on Jun 15, 2023

    @JoostK

    Sharing an additional data point here as well (from evanw/esbuild#3156 (comment)): the issue only reproduces for me using Docker Engine 24, whereas the image works fine using Docker Engine 20. Tested on M1 Max.

  12. GabeDuarteM commented on Jun 15, 2023

    @GabeDuarteM

    This was also happening with me and all my coworkers that use mac for development.

    The "solution" we found for now was to use OrbStack instead, it's a drop-in replacement for docker desktop, and seems to solve this problem. While not ideal, it did unblock us while we wait for the official solution.

  13. featherbread commented on Jun 16, 2023

    @featherbread

    I started looking more closely at the libuv v1.45.0 upgrade after @JoostK mentioned it in the esbuild thread, particularly some of the changes around io_uring support. There is an environment variable (undocumented and unstable, intended for debugging purposes only) to disable libuv's use of io_uring, and with UV_USE_IO_URING=0 set in my container's environment I can no longer reproduce the issue during esbuild installs with any of the Node.js v20.3.0 image variants I've tested (M1 Max, Docker Desktop v4.20.1, Docker Engine v24.0.2).

    I also have an Arch Linux ARM virtual machine on my Mac separate from Docker Desktop, and tried building and installing libuv v1.45.0 there. In that case, I couldn't reproduce the same issue during an esbuild install, even though I could confirm with strace that Node.js was dispatching io_uring operations. That makes me wonder if the kernel version is partly at play (6.3.7 on my Arch VM vs. 5.15.49-linuxkit-pr in the Docker VM). (edit: I set up a separate system with a separate build of Linux 5.15.49, and couldn't reproduce either on the system or with the Docker images. Looking at kernel versions alone may not be a useful lead.)

    Given @evanw's note in the original thread about possible changes to fs.renameSync, it might be notable that rename is apparently one of the operations now backed by io_uring, per libuv/libuv#4012 (my guess is that the *Sync functions in Node.js still use libuv under the hood, but I'm not certain). If that really is where this comes from, the discussion may ultimately belong with libuv, or even with Node.js if it's somehow particular to Node's usage of libuv. (edit: This entire part is incorrect, please see below. Thank you @santigimeno for the correction, I apologize for the error.)

  14. harvey-appleton commented on Jun 16, 2023

    @harvey-appleton

    Experiencing same issue here, but downgrading to node:20-alpine3.16 seems to have fixed it. Seems the issue reappears for us in 20-alpine3.17 (which includes Node 20.3.0) - perhaps (guessing here) it's related to a line in the changelog for Node v20.3.0 which says:

    [bfcb3d1d9a] - deps: upgrade to libuv 1.45.0, including significant performance improvements to file system operations on Linux (Santiago Gimeno) nodejs/node#48078

    (which does backup what @ahamlinman mentioned above)

  15. mgattei commented on Jun 16, 2023

    @mgattei

    Same here for a pipeline that run semantic-release. Gitlab - node:alpine

    - yarn global add handpick
    - handpick --target=devDependencies --manager=yarn
    - yarn semantic-release
    

    Error:

    $ yarn global add handpick
    yarn global v1.22.19
    [1/4] Resolving packages...
    [2/4] Fetching packages...
    [3/4] Linking dependencies...
    [4/4] Building fresh packages...
    success Installed "handpick@7.0.1" with binaries:
          - handpick
    Done in 0.96s.
    $ handpick --target=devDependencies --manager=yarn
    Picking DIRTY devDependencies via YARN
    Done 854 packages in 71.30 seconds
    $ yarn semantic-release
    yarn run v1.22.19
    $ /builds/project/node_modules/.bin/semantic-release
    env: can't execute 'node': Text file busy
    error Command failed with exit code 126.
    

    By retrying several times, it seems to work after a while.... I solved the problem temporarily by downgrading to an older node image.

  16. 73 remaining items

  17. FLX-0x00 commented on May 26, 2024

    @FLX-0x00

    Cant get this working with arch linux 6.9.1-arch. tried nodejs-lts-hydrogen 18.20, nodejs-lts-iron 20.13 or nodejs 22.2

  18. is0ly commented on May 26, 2024

    @is0ly

    yarn set version stable
    yarn install

    from yarn site - fixed this wired behavior without switching kernel version

  19. felixonmars commented on May 26, 2024

    @felixonmars

    Cant get this working with arch linux 6.9.1-arch. tried nodejs-lts-hydrogen 18.20, nodejs-lts-iron 20.13 or nodejs 22.2

    Please try Arch Linux's new kernel 6.9.2-1 and see if it makes a difference.

  20. FLX-0x00 commented on May 26, 2024

    @FLX-0x00

    Cant get this working with arch linux 6.9.1-arch. tried nodejs-lts-hydrogen 18.20, nodejs-lts-iron 20.13 or nodejs 22.2

    Please try Arch Linux's new kernel 6.9.2-1 and see if it makes a difference.

    Still the same error even with new kernel after reboot. Switched to the linux-lts kernel.

  21. MartinX3 commented on May 27, 2024

    @MartinX3

    At my side it got fixed with the upgrade from pnpm 9.1.2 to 9.1.3.
    And I also use the 6.9.2 kernel now.

    I don't know if the fix is in any of these commits or it is just coincidence:
    pnpm/pnpm@v9.1.2...v9.1.3

  22. zguig52 commented on May 27, 2024

    @zguig52

    Workaround to avoid downgrading the kernel:
    UV_USE_IO_URING=0 your_command_using_node

    Ex: UV_USE_IO_URING=0 yarn dev

  23. ZulluBalti commented on May 28, 2024

    @ZulluBalti

    At my side it got fixed with the upgrade from pnpm 9.1.2 to 9.1.3. And I also use the 6.9.2 kernel now.

    I don't know if the fix is in any of these commits or it is just coincidence: pnpm/pnpm@v9.1.2...v9.1.3

    I think it's a coincident as I"m also using pnpm version 9.1.3 with kernel 6.9.2-arch1-1 and still getting this error

  24. ZulluBalti commented on May 28, 2024

    @ZulluBalti

    Cant get this working with arch linux 6.9.1-arch. tried nodejs-lts-hydrogen 18.20, nodejs-lts-iron 20.13 or nodejs 22.2

    Please try Arch Linux's new kernel 6.9.2-1 and see if it makes a difference.

    Nope, it doesn't make any difference still getting this error with 6.9.2-1

  25. MartinX3 commented on May 28, 2024

    @MartinX3

    @ZulluBalti woopsi.
    You're right.
    After a computer restart the issue reappeared at my site as well.

  26. skabber commented on May 28, 2024

    @skabber

    Same error /usr/bin/env: ‘node’: Text file busy using nixos kernel 6.9.2. Backing out to 6.8.11 fixes the issue.

  27. mzndr commented on May 29, 2024

    @mzndr

    For anyone wondering on how to downgrade your arch kernel, you can downgrade to previous installations (of any package) from chache:
    pacman -U /var/cache/pacman/pkg/linux-<your-version>.pkg.tar.zst

  28. skabber commented on May 29, 2024

    @skabber

    Here is the issue tracked on nodejs/node nodejs/node#53051

  29. MikeMcC399 commented on May 3, 2026

    @MikeMcC399
    Contributor

    This issue from 2023 attracted a lot of activity which however stopped in 2024, 2 years ago. I'm going to suggest closing it now for the following reasons:

    Later comments in the discussion thread also referred to Arch Linux, which this repo is not specifically involved in.

    It does not appear that there is any ongoing issue that could be fixed here. Keeping the issue open would only be helpful if there is something that needs to be changed in the Docker build process in this repo.

  30. MartinX3 commented on May 3, 2026

    @MartinX3

    It was fixed with kernel 6.9.3 in june 2024.
    Please close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions