'npm run build' results in Command failed with ENOENT: npm run build
NiketanG opened this issue · 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:
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
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!