avh4 / elm-format

elm-format formats Elm source code according to a standard set of rules based on the official Elm Style Guide
BSD 3-Clause "New" or "Revised" License
1.31k stars 148 forks source link

Failing to install in Github Actions #821

Closed FluidSense closed 1 year ago

FluidSense commented 1 year ago

Hello 👋

I am trying to add elm-format as a dependency to a project, but the step npm ci of my Github Action fails on a relatively simple setup.

npm ERR! -- ERROR -----------------------------------------------------------------------
npm ERR! 
npm ERR! I support your platform, but I could not find the binary package (@avh4/elm-format-linux-x64) for it!
npm ERR! 
npm ERR! This can happen if you use the "--omit=optional" (or "--no-optional") npm flag.
npm ERR! The "optionalDependencies" package.json feature is used by elm-format to install the correct
npm ERR! binary executable for your current platform. Remove that flag to use elm-format.
npm ERR! 
npm ERR! This can also happen if the "node_modules" folder was copied between two operating systems
npm ERR! that need different binaries - including "virtual" operating systems like Docker and WSL.
npm ERR! If so, try installing with npm rather than copying "node_modules".
npm ERR! 
npm ERR! NOTE: You can avoid npm entirely by downloading directly from:
npm ERR! https://github.com/avh4/elm-format/releases/tag/0.8.7
npm ERR! All this package does is distributing a file from there.
npm ERR! 
npm ERR! --------------------------------------------------------------------------------

The workflow file is as little as this:

name: Continuous Integration

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [16.x]

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v2
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'npm'
    - run: npm ci
    - run: npm run build
    - run: npm test

Have I missed something obvious? I tried searching through previous issues, but I could not find anyone with a similar problem.

Any help appreciated!

lydell commented 1 year ago

Your workflow file seems to work for me: https://github.com/lydell/elm-github-actions-test/pull/1

avh4 commented 1 year ago

Yeah, I haven't heard of this before. Personally I'd maybe be looking at:

On Wed, Aug 2, 2023 at 9:55 AM Simon Lydell @.***> wrote:

Your workflow file seems to work for me: lydell/elm-github-actions-test#1 https://github.com/lydell/elm-github-actions-test/pull/1

— Reply to this email directly, view it on GitHub https://github.com/avh4/elm-format/issues/821#issuecomment-1662589055, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAJRSOMNFVNFQCMW5LEE3XTKBA3ANCNFSM6AAAAAA3BLMCVA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

FluidSense commented 1 year ago

Thanks for the help! Probably something to do with the package-lock as you suggest. I set my local node to same version as the runner and recreated the package-lock. That seemed to fix it!