n: "no version found" error on Mac with M1 chip

Using n current or n 8 etc on a Mac with the M1 chip and an older version of n will currently display an error that “no version found”, because there are not yet native versions of node available for the new architecture.

You can download and run node built for the Intel x64 architecture. The installed node will run using Rosetta 2. e.g.

n --arch x64 lts

Another approach is to launch Terminal itself using Rosetta, so that the terminal environment assumes x64.

The n behaviour on Apple M1 will be reviewed when nodejs decide their plans for support:

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 8
  • Comments: 18

Most upvoted comments

Thanks for the info! 😄

For now, I’ll continue to use my workaround via Homebrew which I’ll document here in case it helps anyone else:

brew install node # this gets the arm64 version compiled by Homebrew, currently 15.6.0
$ n 15.6.0
  installing : node-v15.6.0
       mkdir : /Users/parndt/n/n/versions/node/15.6.0
       fetch : https://nodejs.org/dist/v15.6.0/node-v15.6.0-darwin-x64.tar.xz
   installed : v15.6.0 (with npm 7.4.0)

$ rm -rf ~/n/n/versions/node/15.6.0
$ cp -r /opt/homebrew/Cellar/node/15.6.0 ~/n/n/versions/node/
$ brew uninstall node

$ n 15.6
   installed : v15.6.0 (with npm 7.4.3)

When it runs, activity monitor happily shows the Architecture as “Apple” as expected: image

If an older version is installed, e.g. Node 12, which has a different lib/node_modules/npm then problems arise, but if mostly using one version it seems OK.

Some discussion on https://github.com/nodejs/build/issues/2474 in last day is that nodejs are thinking of shipping a fat binary from node 16.

I have been wondering about releasing an interim version of n which defaults to x64 for now, and fine tune it after nodejs start releasing native versions.

Readers, let me know if this would be useful with a 👍 or comment.

Node.js 16 will have a native Apple silicon build (arm64).

There will be a new version of n to default to arm64 native for Node.js v16 and higher.

If Node.js 16 comes out before n is updated, then for n v6.8.0 through v7.1.0 you can specify the architecture explicitly to override it defaulting to x64:

n --arch arm64 16

n does not keep track of which architecture is downloaded, so if you installed x64 first then remove it and download again:

n rm 16
n --arch arm64 16

That might have been released in error, I think the arm64 has gone again!

@shadowspawn wow, you’re right! 😱 it’s gone.

Released n v7.2.1 in preparation for Node.js 16 release.

  • install native arm64 Node.js on Macs with Apple silicon for Node.js 16 and higher

Thanks for confirming @parndt 😄

I don’t have an Apple Silicon Mac and the index.tab did not get updated with arm64 until this morning and Node.js 16 wasn’t out, so while I was fairly confident from manual tests, good to hear it works with the actual release!