Github Action failing at "Build Netlify CLI" with node version

I use the netlify github aciton in order to deploy my site, and I successfully deployed two days ago (2nd September 9.44am BST), but I have gone to do a new deployment today (4th September) and my github actions are failing at the “Build netlify/actions/cli@master” stage. Nothing from my setup has changed, but it’s complaining about node versions.

This is the resut of my deployment

Has something changed here? As nothing has changed from my side.

1 Like

Well, it says you need Node 14 - so why not try using Node 14?

@hrishikesh because the node version isn’t something I control.

This is my deployment workflow

name: Deploy to Netlify

on:
    push:
        branches:
            - 'netlify-deploy'
            - 'main'
        paths:
            - 'api-client/**'
            - 'package.json'
            - 'webclient/**'
            - '.github/workflows/netlify-deploy.yml'

jobs:
    deploy:
        runs-on: ubuntu-latest
        steps:
            - name: Checkout
              uses: actions/checkout@v2

            - name: Build react app
              uses: actions/setup-node@v2
              with:
                  node-version: 16

            - name: npm ci, build
              run: npm run build-web
              env:
                  PUBLIC_URL: ${{ secrets.PUBLIC_URL }}
                  REACT_APP_GOOGLE_CLIENT_ID: ${{ secrets.REACT_APP_GOOGLE_CLIENT_ID }}
                  REACT_APP_FLAG_KEY: ${{ secrets.REACT_APP_FLAG_KEY}}

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

So where should I be updating the node version to 14 when I already specify 16??

Unless you’re suggesting that I need to update your dockerfile in your github action actions/Dockerfile at master · netlify/actions · GitHub as that is what is requesting node 12, not anything to do with me!

1 Like

I don’t know how this is a Netlify issue - if you’re specifying Node 16 in your GitHub Action, but it’s still using Node 12 - to me it sounds more like a GitHub issue than Netlify. If this was happening when building on Netlify, that’s something we can debug - but this is happening outside of Netlify.

In any case, that action isn’t doing anything special and you can most likely stop using it and directly deploy using Netlify CLI inside your GitHub Action.

You can replace this part:

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

with

            - name: Deploy to Netlify
              run: npx netlify deploy --build --prod
              env:
                  NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
                  NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}

Even if it’s something being caused by the action, it was last updated 2 years ago and with CLI being the de facto option to deploy sites, I don’t think it’s being maintained at this point.

For anyone else coming here with the same Netlify github action problem, the solution above should read npx netlify-cli deploy --build --prod

+1 Bump! This is also happening to me too. Just started today with no changes on my side.

Hey @spamsencer

Scott has already offered a working solution. Have you tried this yet? If this doesn’t work can you share the error(s) you are receiving?

Hey, yes. After changing the to the provided format (with the run command), I start getting ENTNO errors from node:

npm ERR! enoent ENOENT: no such file or directory, open '/home/runner/work/MyPackage/MyPackage/package.json'

The package.json is missing at this location. Given MyPackage is in the path twice, I wonder if the path is actually correct?

I’m also started facing the same issue from today

The node 12 is set in the action Dockerfile: actions/Dockerfile at 6c34c3fcafc69ac2e1d6dbf226560329c6dfc51b · netlify/actions · GitHub

I think you need to update it to 14.

1 Like

Yep, agree with Leksat. Seems like some packages used by netlify cli have been upgraded and now require a higher node version. Should be a case of just upgrading the base docker file. Almost certain this is on netflify’s end.

Will add though - the solution above that uses npx instead of the github action did work for me. But I do think the action is broken

Hey there, folks :wave:

Our suggestions here are to upgrade the node version to 14. Additionally, if this doesn’t work, we recommend following Scott’s suggestion above.

Our Support Engineers have shared this obstacle with our Engineering team. If there are any changes to this in the future, we will follow up on this thread.

Thanks!

@hillary It’s really worth noting here that upgrading to node version 14 is something Netlify have to do on their Github Action. This is not something all of us need to do. I know the workaround works just fine, but it really has to be stressed that if a fix were to come it must come from Netlify. Or you have to document that the Github Action is no longer supported.

I’m completely blocked by this too, can’t deploy any of my projects. Example:

Is there a ETA on when the node version in the Dockerfile will get bumped?

@mjgs there is a workaround posted above that does work, I moved my github actions to it and have had no problems since.

Thanks is that the post about using npx?

I guess I’ll need to refactor my workflow to make sure node is installed before that step.

Are there any other downsides to using npx?

Not really. If it helps, this is my jobs section of my own workflow

jobs:
    deploy:
        runs-on: ubuntu-latest
        steps:
            - name: Checkout
              uses: actions/checkout@v2

            - name: Build react app
              uses: actions/setup-node@v2
              with:
                  node-version: 16

            - name: npm ci, build
              run: npm run build-web
              env:
                  PUBLIC_URL: ${{ secrets.PUBLIC_URL }}
                  REACT_APP_GOOGLE_CLIENT_ID: ${{ secrets.REACT_APP_GOOGLE_CLIENT_ID }}
                  REACT_APP_FLAG_KEY: ${{ secrets.REACT_APP_FLAG_KEY}}

            - name: Deploy to Netlify
              run: npx netlify-cli deploy --build --prod --dir=./webclient/build
              env:
                  NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
                  NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
1 Like

@scottlovegrove Thanks for the example code.

I’m wondering why even bother using actions directly for cli tools, if by using npx you gain control of the node version?

Is it just that companies want to be visible in the actions market place?

I’m just trying to decide if I should start using npx more broadly to avoid these types of situations going forward.