supermedium / moonrider

🌕🏄🏿 Surf the musical road among the stars. Side project built by two people in a few months to demonstrate WebXR.
https://moonrider.xyz
MIT License
590 stars 230 forks source link

"npm install" errors with "Failed to find Electron v1.7.11 for darwin-arm64" #167

Open klyap opened 1 year ago

klyap commented 1 year ago
npm ERR! npm ERR! Error: Failed to find Electron v1.7.11 for darwin-arm64 at https://github.com/electron/electron/releases/download/v1.7.11/electron-v1.7.11-darwin-arm64.zip

This seems to be an issue specifically for running on M1 Macbooks.

sunnypranay commented 1 year ago

Hello @klyap,

It appears that the Electron version you're trying to use is not compatible with the arm64 architecture of your Apple Silicon Mac when using a version of Node.js newer than v12. To address this, you can use Node Version Manager (nvm) to install and manage an older Node.js version. However, since the required version of Electron is not available for arm64, you will need to run your terminal under Rosetta, which allows you to use software designed for Intel x86 architecture.

Here's a step-by-step guide to resolve the issue:

  1. Install Rosetta 2 (if not already installed):

    Open the terminal and run the following command:

    /usr/sbin/softwareupdate --install-rosetta --agree-to-license
  2. Open Terminal using Rosetta:

    • Find the Terminal application in Finder (usually under Applications > Utilities).
    • Duplicate Terminal (so you have the original version intact).
    • Right-click on the duplicated Terminal and select "Get Info."
    • Check the box for "Open using Rosetta" and close the info window.
  3. Install nvm:

    Open the Rosetta Terminal and install nvm by running the script from their GitHub repository (https://github.com/nvm-sh/nvm). You can usually do this with the following command:

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash

    (Make sure to use the latest installation script from the nvm GitHub page.)

  4. Close and reopen the Terminal:

    This is to ensure the nvm commands are available in your terminal session. Open the Rosetta Terminal again.

  5. Install and use Node.js v11:

    With nvm now installed, you can install Node.js v11 with:

    nvm install 11
    nvm use 11
  6. Verify the Node.js version:

    Ensure you're now using the correct Node.js version with:

    node -v
  7. Proceed with Electron installation:

    Now, try installing Electron again or running your npm commands that were failing previously.

Please let me know if this resolves your issue, or if you run into any more trouble!