actions icon indicating copy to clipboard operation
actions copied to clipboard

'npm run build' results in Command failed with ENOENT: npm run build

Open NiketanG opened this issue 4 years ago • 3 comments

Using the action to build and then deploy a Next.js Project to Netlify from Github CI/CD. The Config is as follows:

      - name: 🧰 Install dependencies for Next.js Build
        run: npm install
        
      - name: 📦 Run Next.js build to generate the static files
        run: npm run build

      - name: 🚀 Deploy to Netlify
        id: deploy-netlify
        uses: netlify/actions/cli@master
        env:
          NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
          NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
        with:
          args: build


This uses the netlify-plugin-nextjs. Which fails to build the project (execute npm run build) with the following error:

Screenshot from 2022-02-23 01-43-51

NiketanG avatar Feb 22 '22 20:02 NiketanG

Did you ever get a resolution for this @NiketanG ? I'm having a similar issue

grgcnnr avatar Apr 23 '22 05:04 grgcnnr

Did you ever get a resolution for this @NiketanG ? I'm having a similar issue

Me too. I think it is due to the alpine image. Maybe using the not alpine one solve the issue, cause I think it is due to the fact that in alpine docker image version the bash is not installed by default

mcolombosperoni avatar Jun 17 '22 16:06 mcolombosperoni

I guess this issue is related to https://answers.netlify.com/t/build-command-failed-using-the-netlify-cli-on-gitlab-runner/43543/5

I figured out the problem, the node:15.14.0-alpine Docker image doesn’t have bash included which netlify build relies on for running the build command on Linux.

The spawn bash ENOENT error was because it couldn’t find bash.

It seems that the ‘alpine’ Node Docker images don’t have bash and this was fixed by using the standard image: node:15.14.0 instead.

Got there in the end.

Thanks for your help, much appreciated!

alexjorgef avatar Dec 17 '22 03:12 alexjorgef