Fix: Maven issue running 'mvn install' on Macbooks with M1 processors, failing to install Node

paul_mitchell
ServiceNow Employee
ServiceNow Employee
For reference...
 
NOTE: Before trying this fix, first try running 'mvn clean install -Dfrontend.version=1.11.0' instead of 'mvn clean install'.
 
I had an issue where a module (pom.xml) wouldn't build on my machine as the process was trying to download a version of node that no longer existed - node-14.16.0-darwin-arm64.tar.gz
My Mac uses a Silicon processor (M1), not Intel x86 which is why it looks for the arm64 version.
What is peculiar about this is that sometimes, on identical M1 Macbooks, the issue doesn't arise as Maven looks for the x86 version of node.
I eventually figured out that before downloading, the install process looks for the file here:
/Users/user.name/.m2/repository/com/github/eirslett/node/14.16.0/node-14.16.0-darwin-arm64.tar.gz
 
A workaround is as follows:
  1. Download the x84 version from nodejs (Note: Depending on your module, you might need a different version number but the fix should still work, just make sure to replace v14.16.0 with the correct version number):
    https://nodejs.org/download/release/v14.16.0/node-v14.16.0-darwin-x64.tar.gz
  2. Unzip the file.
  3. Rename the unzipped folder: node-v14.16.0-darwin-arm64
  4. Run: tar -cvzf node-14.16.0-darwin-arm64.tar.gz node-v14.16.0-darwin-arm64
    Note: the source folder has a 'v' before the 'node-v14...', but the target tar.gz file does not have the 'v'.
    This is necessary or it won't work.
  5. Copy the new tar.gz file into:
    /Users/user.name/.m2/repository/com/github/eirslett/node/14.16.0/
  6. After doing the above, mvn install should now work fine.
I have attached a screenshot showing an example of this failure.
 
If you are having issues getting this fix to work you can reach me on Teams or paul.mitchell@servicenow.com
 
0 REPLIES 0