Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download x64 binary on Apple Silicon #949

Merged
merged 2 commits into from Dec 15, 2020
Merged

Download x64 binary on Apple Silicon #949

merged 2 commits into from Dec 15, 2020

Conversation

ajthom90
Copy link
Contributor

@ajthom90 ajthom90 commented Dec 15, 2020

Summary

I have been testing out an Apple Silicon Mac mini. I am using the Azul Zulu arm64 OpenJDK (JDK 8). This change tells the plugin to download the x64 version of Node on macOS, which should run fine under Rosetta.

I'm happy to write up an issue also, if you so desire! Thank you!

Tests and Documentation

When building using Maven on Apple Silicon, I receive an error, as the URL generated by the plugin doesn't work, since there is not currently (as of 12/15/2020) an arm64 version of Node for macOS. So, this uses a simple check when generating the download URL: if the OS is Mac, and the architecture is arm64, download the x64 binary.

[INFO] 
[INFO] --- frontend-maven-plugin:1.9.1:install-node-and-npm (install-npm) @ <<PROJECT NAME>> ---
[INFO] Installing node version v11.9.0
[INFO] Downloading https://nodejs.org/dist/v11.9.0/node-v11.9.0-darwin-arm64.tar.gz to /Users/localuser/.m2/repository/com/github/eirslett/node/11.9.0/node-11.9.0-darwin-arm64.tar.gz
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.065 s
[INFO] Finished at: 2020-12-15T13:10:54-08:00
[INFO] Final Memory: 29M/359M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.9.1:install-node-and-npm (install-npm) on project <<PROJECT NAME>>: Could not download Node.js: Got error code 404 from the server. -> [Help 1]

@ajthom90 ajthom90 marked this pull request as ready for review December 15, 2020 21:38
@eirslett
Copy link
Owner

Ok, thanks!

@eirslett eirslett merged commit 7356784 into eirslett:master Dec 15, 2020
@eirslett
Copy link
Owner

Should be released now, in version 1.11.0. Could you follow up this whenever Node.js publishes arm64 builds? Then we could switch back, if that's worth the extra work.

@ajthom90
Copy link
Contributor Author

Absolutely. I'll put a reminder on my calendar to check weekly. Thanks for your quick reply on this, I appreciate it!

@grishka
Copy link

grishka commented Dec 15, 2021

Uhh sorry but why is this a thing? As of right now, there are native ARM macOS builds available using that exact URL format:

https://nodejs.org/dist/v16.13.1/node-v16.13.1-darwin-arm64.tar.gz

Could you please undo this PR?

@eirslett
Copy link
Owner

Uhh sorry but why is this a thing? As of right now, there are native ARM macOS builds available using that exact URL format

It's because @ajthom90 should check weekly if there was a native arm64 build 😉

Since when did they start publishing Silicon builds? Maybe we need some version smartness in the plugin, so that it downloads the x64 one for older versions of Node, and arm64 for newer versions of Node.

@grishka
Copy link

grishka commented Dec 15, 2021

Since when did they start publishing Silicon builds?

No idea. I just got my M1 macbook last Friday and noticed that this plugin downloads an x86 build, while the standalone node I installed is universal.

Maybe we need some version smartness in the plugin, so that it downloads the x64 one for older versions of Node, and arm64 for newer versions of Node.

Yeah, that makes sense in case someone needs an older version. Maybe I should even send a PR of my own 🤔

@grishka
Copy link

grishka commented Dec 15, 2021

It appears that they have started providing arm64 builds since 16.0.0. That's convenient for comparison. I'll submit a PR.

@grishka
Copy link

grishka commented Dec 15, 2021

image
Huh? It's already done in this exact way in commit 4a63273 🤔🤔🤔🤔🤔

Sorry, I'm stupid. I just needed to update the node version in my pom.xml to something newer.

@ajthom90
Copy link
Contributor Author

Huh? It's already done in this exact way in commit 4a63273 🤔🤔🤔🤔🤔

It's because @ajthom90 should check weekly if there was a native arm64 build 😉

Haha whoops! Glad that @grishka spotted that this was already fixed! I'd stopped checking for arm64 native node builds because I remembered that commit! Thanks all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants