Skip to content

Build fails if npm install in build command #255

@coffee-cup

Description

@coffee-cup

If you have npm ci or npm install in the build command, then the build will fail. You can reproduce with

go run cmd/cli/main.go build examples/node-npm --build-cmd "npm ci"

and you get this error

 > npm ci:
0.236 npm warn config production Use `--omit=dev` instead.
0.425 npm error code EBUSY
0.425 npm error syscall rmdir
0.425 npm error path /app/node_modules/.cache
0.425 npm error errno -16
0.425 npm error EBUSY: resource busy or locked, rmdir '/app/node_modules/.cache'
0.426 npm error A complete log of this run can be found in: /root/.npm/_logs/2025-09-09T19_30_11_090Z-debug-0.log
------
 ERRO failed to solve: failed to solve: process "sh -c npm ci" did not complete successfully: exit code: 240
Image

If you comment out this line, then the build works.

For some reason the node_modules/.cache during the build step is causing issues. I initially thought that adding this cache during the install step would help, but I still get the same error.

We might want to detect if npm install is being run in build and remove that cache?

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