'getting unexpected token in mac terminal after installing node

Everytime i open terminal in mac, i get the below error,

/usr/local/lib/node_modules/npm/lib/cli.js:2
module.exports = async (process) => {
                       ^
SyntaxError: Unexpected token (
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:2:1)
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run `npm config delete prefix` or `nvm use --delete-prefix v6.10.3 --silent` to unset it.

How can i fix it? I am using node version v16.13.2 and npm 8.1.2 in macOs Monterey.



Sources

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

Source: Stack Overflow

Solution Source