Closed dougouverson closed 3 years ago
Deleting that line in .npmrc
should indeed have fixed it (it shouldn't be there at all).
You're saying that nvm use --delete-prefix v15.1.0
still doesn't work after that? What code does it exit with (echo $?
)?
Also, what does npm config get prefix
and which node
print out when you're using your system node?
$ nvm use --delete-prefix v15.1.0 --silent $ echo $? 0
$ npm config get prefix /Users/dougouverson/.nvm/versions/node/v15.1.0
$ cat .npmrc prefix=/Users/dougouverson/.npm
How can I figure out what program/script keeps writing to .npmrc?
I’m afraid that’s something i cant help you with :-/ you might have a npm config set prefix
command somewhere, or just be appending to the file directly.
You could try changing the permissions on npmrc so nothing can write to it, and see what errors?
I’m going to close this for now, since the issue isn’t with nvm, just with whatever’s setting your “prefix” setting.
This is disappointing. Where am I to go to get help fixing an NVM issue if not in the NVM issue desk?
You say the issue isn't with NVM, and that may be the case. But, this is the second time I've had this issue with getting Node environment set up on macOS, and the only thing in common was NVM.
What else could it be?
Or maybe you could point me in a direction where I could get help.
Thanks so much.
And I don't think my issue was "invalid" - humbly!
Sorry if I was unclear :-) I'm happy to keep trying to help! However, i don't think there's anything i can fix in nvm about it, since nvm is incompatible with the "prefix" setting.
As for "invalid", you're right, that's probably not the best label name - it just means "not a problem with nvm". I'll rename the label slightly.
Can you share the content of your profile files? (with any sensitive info redacted)
Can you share the contents of .zprofile
and .zshrc
?
Everything seems to working fine now.
I was able to remove the .npmrc and nothing is writing it again. I'm not sure what script/program created .npmrc in the first place?
Question:
I noticed that when I quit and restart terminal that node version reverts to default (in my case v12.19.0)
Is this normal behavior?
Glad to hear it!
Yes, that’s expected. You can change the default with nvm alias default
, or remove it with nvm unalias default
.
Thanks so much for hanging in there with me!
Honestly, can't wait for the day when we will have a productive day of coding, the complexity of elements involved in Node is more of politics than a necessity, never mind dealing with MacOs changes and updates that are actually needed. It feels like a war zone and we are in the middle of it. And yes, as dougouerson pointed out the solution is never in one place. Like you guys never used the software before ...vim got nothing to do with it. Who says that everything is connected in the system and this is why we seek to advise. Only if Node people can put their instructions in one place instead of throwing a bug at us and we have to deal with it. I do more debugging than coding, and coding in React is pretty straight forward, few things to watch out for ... just saying it shoudn't be that hard to assist others.
Had the same issue as above. Thanks for telling us to check .zshrc
@ljharb!
Solved it by commenting out/removing the line in there that said
npm set prefix ~/.npm;
Which was clearly creating it everytime I opened up a new terminal.
You can then safely remove the .npmrc
if you're not using it for anything else than that prefix.
Had the same issue after installing nvm on ubuntu with ZSH
Solved it by simply running the mentioned command:
nvm use --delete-prefix v12.22.10 --silent
I think the reason why I use prefix is because it can put all the global dependencies into the directory I specify, but now it is not compatible with prefix in nvm, so how do I set the global dependencies into the directory I specify?🤔🤔🤔
@CodeGetters that's not a good thing to do, though, so the answer is "you don't". Global deps must never be shared across node versions anyways.
@CodeGetters that's not a good thing to do, though, so the answer is "you don't". Global deps must never be shared across node versions anyways.
I have thought about the advantages and disadvantages according to your answer and found the use I used before, focusing on quick use and not paying attention to the problems it may cause. Thank you very much for your answer!😉
Operating system and version:
nvm debug
output:nvm ls
output:How did you install
nvm
?curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | bash
What steps did you perform?
Ran commands to install and use node
nvm install node
nvm use node
What happened?
It seems that nvm did in fact install v15.1.0 but I'm also getting this error message every time I open a new terminal window:
What did you expect to happen?
Not to get an error message.
I did run
nvm use --delete-prefix v15.1.0 --silent
but this did not fix.I did shut down iTerm and restarted - only to get error message.
One thing I did notice: I opened .npmrc and see there is one line:
Just to see what would happen, I deleted this line > saved file > exited and opened iTerm. No change.
Is there anything in any of your profile files that modifies the
PATH
?Not that I'm aware of. zsh is now the default shell on macOS 10.15.7