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

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.

I think it entirely depends on the service and what you need to do. We have some very comprehensive internal actions where I work that you couldn’t just do with a simple npx call.

I’m not sure whether npx was a viable option with netlify when they created their action, so that could be why.

Btw I got the npx deploys working now. Thanks.

It would be good to get a definitive answer from Netlify as to which is the supported way of using the action, just to avoid breakages down the line.

npx is not a Netlify-thing - that’s something offered by npm. As long as npx continues to do what it’s doing, the above workaround will continue to work.

I’ve said it before, will say it again - the action is not doing anything fancy - it’s doing the exact same thing that I’ve asked folks to do - that is to use Netlify CLI. Just that, with the method suggested above, instead of relying on an action to call Netlify CLI, you’re doing it yourself.

Thanks again for pointing out the workaround. I’m happy to have a workaround, however it feels like all my projects are now running on a bandaid which isn’t a great feeling.

It feels like if I don’t say something then this might just get disappeared into a very long backlog.

One thing that isn’t so good with the workaround is that I am now leaking info to npm about every deploy I do, whereas previously it would have just been Github that could see that info.

Ultimately I’d like to be using the action as it’s supposed to be used rather than via npx.

Hey @mjgs ! Sorry about the delay on this one, we were waiting for the engineering team to finish work on the fix. This should be working as of now, but please let us know if you see any other issues, and thanks again for your patience!

Thanks for the update @amelia.

It whave been nice to get a note in the thread at the time, rather than leave me hanging , but thanks al the same.

I’ll test it out.