Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Node 14 on a M2 Chip Apple Macbook Air?

I need to work on a project that uses Node v14.17.3. In my previous Macbook with intel chip I had node 16 but in this particular project I ran npm install [email protected] and everything worked fine.

The project has the version specified on package.json file:

 "engines": {
    "node": "v14.17.3"
  },

When I try to install node 14 on the project using my M2 Chip Macbook I get the following error:

 command sh -c node installArchSpecificPackage
npm ERR! npm ERR! code ETARGET
npm ERR! npm ERR! notarget No matching version found for [email protected].
npm ERR! npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! npm ERR! notarget a package version that doesn't exist.
npm ERR! 
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     /Users/enzo/.npm/_logs/2023-02-04T02_37_49_054Z-debug-0.log
npm ERR! node:internal/modules/cjs/loader:1050
npm ERR!   throw err;
npm ERR!   ^
npm ERR! 
npm ERR! Error: Cannot find module 'node-bin-darwin-arm64/package.json'
npm ERR! Require stack:
npm ERR! - /Users/enzo/Documents/Project/frontend/node_modules/node/installArchSpecificPackage.js
npm ERR!     at Module._resolveFilename (node:internal/modules/cjs/loader:1047:15)
npm ERR!     at Function.resolve (node:internal/modules/cjs/helpers:109:19)
npm ERR!     at ChildProcess.<anonymous> (/Users/enzo/Documents/TeCambio/frontend/node_modules/node-bin-setup/index.js:19:27)
npm ERR!     at ChildProcess.emit (node:events:513:28)
npm ERR!     at maybeClose (node:internal/child_process:1091:16)
npm ERR!     at ChildProcess._handle.onexit (node:internal/child_process:302:5) {
npm ERR!   code: 'MODULE_NOT_FOUND',
npm ERR!   requireStack: [
npm ERR!     '/Users/enzo/Documents/Project/frontend/node_modules/node/installArchSpecificPackage.js'
npm ERR!   ]
npm ERR! }
npm ERR! 
npm ERR! Node.js v18.14.0

Is there any solution/workaround for this issue? I was thinking about installing Rosseta and NVM but I'd rather do this with some better solution. Thanks in advance!

like image 270
Enzo Barrera Avatar asked Sep 10 '25 11:09

Enzo Barrera


1 Answers

The approved answer didn't work for me. I had to switch the arch to x86 and then install and set the active node version.

arch -x86_64 zsh
nvm install 14
nvm use 14

That works for me.

like image 78
IslamTaha Avatar answered Sep 13 '25 02:09

IslamTaha