volta-cli / volta

Volta: JS Toolchains as Code. ⚡
https://volta.sh
Other
10.91k stars 227 forks source link

When installing node@8 on Apple M series chips, Volta generates an invalid URL path #1860

Open zhongduyiyu opened 3 weeks ago

zhongduyiyu commented 3 weeks ago

volta pin node@8 --verbose [verbose] Loaded custom hooks file: /Users/local-admin/.volta/hooks.json [verbose] Using node.index hook to determine node index URL [verbose] Found valid cache of Node version index [verbose] Found node@8.17.0 matching requirement '>=8.0.0 <9.0.0-0' from https://mirrors.dotsrc.org/nodejs/release/index.json [verbose] Acquiring lock on Volta directory: /Users/local-admin/.volta/volta.lock [verbose] Using node.distro hook to determine download URL [verbose] Downloading node@8.17.0 from https://mirrors.dotsrc.org/nodejs/release/v8.17.0/node-v8.17.0-darwin-arm64.tar.gz [verbose] Unlocking Volta Directory error: Could not download node@8.17.0 from https://mirrors.dotsrc.org/nodejs/release/v8.17.0/node-v8.17.0-darwin-arm64.tar.gz

I'd like to point out that earlier versions (<16)of Node.js actually don't include packages specifically for darwin-arm64 architecture.

zhongduyiyu commented 3 weeks ago

I resolved the issue by using a custom installation method. Below is the documentation of my successful upgrade, and I hope it can help you. https://beaded-mandolin-12a.notion.site/EN-Volta-Custom-Node-js-Installation-Guide-5404997fbc554694b981fbbd4bdeac7d

charlespierce commented 3 weeks ago

Hi @zhongduyiyu, thanks for the report! I suspect this is an issue with our somewhat haphazard hooks implementation—when we're not using hooks, we correctly fall back to the Intel version of Node for versions < 16. However, I bet we're unconditionally passing the actual architecture to the hook, rather than being smart about the version.

pjking07 commented 3 weeks ago

I encountered this behavior for custom hooks in Windows Arm as well, and I'll note that Node provides Windows Arm installers for >=19. So, custom hooks will fail in the Windows Arm build of volta v2 for node versions <19.

Thanks for the above explanation @charlespierce 🥇