Error nvm is not compatible with the npm config prefix option

0 votes

I am trying to run another NodeJS version with nvm but getting this error:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm .

Is there any way I can use nvm without losing my prefix for globally installed packages?

Jul 15, 2020 in Node-js by kartik
• 37,510 points
4,166 views

1 answer to this question.

0 votes

Hello @kartik,

After installing nvm using brew, create ~/.nvm directory:
$ mkdir ~/.nvm

and add following lines into ~/.bash_profile:

export NVM_DIR=~/.nvm
. $(brew --prefix nvm)/nvm.sh

Open a new terminal and this time it should not print any warning message.
Check that nvm is working by executing nvm --version command.
After that, install/reinstall NodeJS using nvm install node && nvm alias default node.

Hope this is helpfull!!

Thanks!!

answered Jul 15, 2020 by Niroj
• 82,880 points

Related Questions In Node-js

0 votes
0 answers
0 votes
1 answer

Error:“NODE_ENV” is not recognized as an internal or external command, operable command or batch file

Hello @kartik, It sounds like your error comes ...READ MORE

answered Jul 16, 2020 in Node-js by Niroj
• 82,880 points
19,329 views
0 votes
1 answer

What is the best way to run npm install for nested folders?

Hello @kartik, If you want to run a ...READ MORE

answered Jul 17, 2020 in Node-js by Niroj
• 82,880 points
13,354 views
0 votes
1 answer

Error:npm not working after clearing cache

Hello @kartik, Try this: npm cache clean --force OR It ...READ MORE

answered Jul 17, 2020 in Node-js by Niroj
• 82,880 points
6,019 views
0 votes
1 answer

jQuery AJAX fires error callback on window unload - how do I filter out unload and only catch real errors?

Hello, In the error callback or $.ajax you have three ...READ MORE

answered Apr 27, 2020 in Java-Script by Niroj
• 82,880 points
3,689 views
0 votes
1 answer

How do I pass command line arguments to a Node.js program?

Hello @kartik, If your script is called myScript.js ...READ MORE

answered May 5, 2020 in Java-Script by Niroj
• 82,880 points
2,898 views
0 votes
1 answer

Error:Issue when trying to use IN() in wordpress database

Hello @kartik, Try this code : // Create an ...READ MORE

answered May 8, 2020 in PHP by Niroj
• 82,880 points
818 views
+2 votes
1 answer

How do I debug Node.js applications?

Hello @kartik, Use node-inspector  from any browser supporting WebSocket. Breakpoints, ...READ MORE

answered Jul 8, 2020 in Node-js by Niroj
• 82,880 points
756 views
0 votes
1 answer

Error:Failed to parse json-This is not a bug in npm.

Hello @kartik, Try this: npm cache clean Hope it works!! Thank ...READ MORE

answered Nov 27, 2020 in Node-js by Niroj
• 82,880 points
3,945 views
0 votes
1 answer

Error:sudo: npm: command not found

Hello @kartik, I had the same problem; here ...READ MORE

answered Jul 15, 2020 in Node-js by Niroj
• 82,880 points
11,923 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP