'How can I install NVM in mac

I am getting below error while installing NVM.

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

Error ->

VFZ:repo2022 john$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4934  100  4934    0     0    686      0  0:00:07  0:00:07 --:--:--   686
bash: line 1: syntax error near unexpected token `('
bash: line 1: `<!-- Copyright (C) 2016 Intel Corporation. All rights reserved. -->'
VFZ:repo2022 john$ 

System - MAC



Solution 1:[1]

There is a solution using 'Rosetta 2' From terminal:

$ sudo softwareupdate --install-rosetta

Install NVM using curl (found on the NVM Readme)

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

Then install whatever Node version (example installs latest)

$ nvm install node

Check Node Version

$ node -v

Source: https://dev.to/httpjunkie/setup-node-version-manager-nvm-on-mac-m1-7kl

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 GatesKennedy