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

No binaries are available for your platform: linux-arm64 #765

Closed os6sense closed 1 year ago

os6sense commented 2 years ago

Attempting to install and build on a linux based container on an M1 using 0.8.5:

       → error /app/node_modules/elm-format: Command failed.
       → Exit code: 1
       → Command: binwrap-install
       → Arguments: 
       → Directory: /app/node_modules/elm-format
       → Output:
       → /app/node_modules/binwrap/install.js:18
       →     throw new Error("No binaries are available for your platform: " + buildId);
       →     ^
       → 
       → Error: No binaries are available for your platform: linux-arm64
       →     at install (/app/node_modules/binwrap/install.js:18:11)
       →     at Object.install (/app/node_modules/binwrap/index.js:14:14)
       →     at Object.<anonymous> (/app/node_modules/binwrap/bin/binwrap-install:18:9)
       →     at Module._compile (node:internal/modules/cjs/loader:1103:14)
       →     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
       →     at Module.load (node:internal/modules/cjs/loader:981:32)
       →     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
       →     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
       →     at node:internal/main/run_main_module:17:47
       → info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

This is a slightly different scenario over running this on darwin-arm64 since here I'm attempting to build and run in a container.

Zeneixe commented 2 years ago

I have the same problem

avh4 commented 1 year ago

I'm trying to get linux-arm64 binaries build for the next release. Can anyone test running the aarch64 binary here: https://elm-format.avh4.net/manual/0.8.5-424-g9e071c6f/ and see if it works in the Linux ARM64 environment that they need it for?

jsynacek commented 1 year ago

Can anyone test running the aarch64 binary here:

Seems to be working well for me.

(I'm on M1 Mac using Docker Desktop and a linux container.)

$ uname -a
Linux 7bed0a212d7c 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
avh4 commented 1 year ago

Fixed in https://github.com/avh4/elm-format/pull/798 The next release (0.8.6) will include official linux-aarch64 static binaries.

Thanks @jsynacek for testing!

jsynacek commented 1 year ago

With the latest release, I still get the error... Maybe the problem is that the code checks for linux-arm64 while the binary is marked as linux-aarch64 ? This architecture check feels a bit redundant to say the least. It's just elm tooling that has this problem, I haven't run into anything like that with other npm packages. Why would elm tooling care about the architecture, anyway? The binaries work, though.

avh4 commented 1 year ago

This works for me, on Linux 712344e8f084 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 GNU/Linux:

npm install --save-dev elm-tooling
npx elm-tooling init
npx elm-tooling install
./node_modules/.bin/elm-format

You need elm-tooling >= 1.13.0.

This also works for me:

npm install --save-dev elm-format
./node_modules/.bin/elm-format

Is it one of those that you're having problems with?

lydell commented 1 year ago

@jsynacek You can see the values that Node.js uses for the architecture here: https://nodejs.org/api/process.html#processarch

You can run this to see what the values are for your platform: node -p '[process.platform, process.arch]'

elm-tooling (and the elm-format@0.8.6 npm package) checks the os+architecture because different compiled binaries only work on certain os+arch combinations. For example, a Windows binary does not work on Linux. A Linux x86_64 (x64 using Node.js’ values) binary does not work on Linux aarch64 (arm64 using Node.js’ values).

Most npm packages are written in JavaScript (an interpreted language), so they don’t need to think about architectures. elm-format is written in Haskell (a compiled language), and elm-tooling and the elm-format@0.8.6 npm package only distribute pre-compiled executables.

Also, next time, it’d be very helpful if you posted the error message you got from the get go.

Edit: Looks like me and @avh4 replied at the same time :)

jsynacek commented 1 year ago

Ok, I created a minimal package.json with the following content and it works for me:

{
    "name": "test-app",
    "version": "1.0.0",
    "devDependencies": {
      "elm-format": "^0.8.6",
      "elm-tooling": "^1.13.0",
      "elm": "0.19.1-4"
    }
}

So I guess there must be something else in the real package.json that keeps dragging in the old dependencies.

Also, next time, it’d be very helpful if you posted the error message you got from the get go.

Sorry about not being clearer. When I wrote "With the latest release, I still get the error...", for some reason I thought it was clear that "the error" was the original error from the description.

Anyway, thank you all for the help and for the new release!