Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.npmrc prefix override nvm #606

Closed
SeeThruHead opened this issue Jan 9, 2015 · 18 comments
Closed

.npmrc prefix override nvm #606

SeeThruHead opened this issue Jan 9, 2015 · 18 comments
Assignees

Comments

@SeeThruHead
Copy link
Contributor

@SeeThruHead SeeThruHead commented Jan 9, 2015

symptoms, npm install -g npm installs npm to the wrong directory
overridden by .npmrc

removing "prefix=~/.node" from npmrc fixes the issue

osx ver: osx 10.10.1

zsh ver: zsh 5.0.5 (x86_64-apple-darwin14.0)

.npmrc:
prefix=~/.node

@wilmoore
Copy link

@wilmoore wilmoore commented Jan 12, 2015

I don't believe this is an nvm specific issue.

@ljharb
Copy link
Member

@ljharb ljharb commented Jan 12, 2015

I asked @SeeThruHead to file this - the problem as I see it is that nvm (correctly) doesn't respect npm's prefix option, but npm itself will.

I'm not sure how to handle this, but at the least, nvm could print out a warning.

@ljharb
Copy link
Member

@ljharb ljharb commented Mar 13, 2015

Noting from #427 that the env var $NPM_CONFIG_PREFIX also causes problems with nvm.

@kriswill
Copy link

@kriswill kriswill commented Mar 13, 2015

Maybe detect the nvm config setting upon installation and issue a stern warning?

@ljharb
Copy link
Member

@ljharb ljharb commented Mar 13, 2015

I'm considering making nvm refuse any operation whatsoever when problematic settings are set.

@kriswill
Copy link

@kriswill kriswill commented Mar 13, 2015

sure, just do a npm config get prefix and if it doesn't contain /.nvm/ then bail out.

@ljharb
Copy link
Member

@ljharb ljharb commented Mar 16, 2015

Also $PREFIX, apparently, thanks to #692.

@ljharb ljharb self-assigned this Mar 16, 2015
@ELLIOTTCABLE
Copy link
Contributor

@ELLIOTTCABLE ELLIOTTCABLE commented Apr 13, 2015

Ugh. Until this is patched, you might want to put a note in the README … I have no idea where my ~/.npmrc came from, but I've been complaining about being unable to update npm for ages. (At least now I know why.)

@ljharb
Copy link
Member

@ljharb ljharb commented Apr 13, 2015

Good idea - I'll get to one or the other hopefully in the next few weeks, but a README PR is welcome in the meantime.

@usmonster
Copy link

@usmonster usmonster commented Aug 27, 2015

Can this be closed since 7ea15a7?

@ljharb
Copy link
Member

@ljharb ljharb commented Aug 27, 2015

I'm leaving it open until nvm itself refuses to do anything when a prefix is set.

@ljharb ljharb closed this in 1458de7 Sep 23, 2015
@ljharb
Copy link
Member

@ljharb ljharb commented Sep 23, 2015

Now nvm use will refuse to work if $PREFIX or npm config get prefix is set, and will provide instructions about how to fix it.

Reopening, however, because I forgot about $NPM_CONFIG_PREFIX.

@leomoreno
Copy link

@leomoreno leomoreno commented Feb 27, 2017

Would be nice if this prefix thing could be omitted somehow through .nvmrc (just thinking).

@ljharb
Copy link
Member

@ljharb ljharb commented Feb 27, 2017

@leomoreno in what way? The whole concept of PREFIX is incompatible with nvm.

@elmorenocivitas
Copy link

@elmorenocivitas elmorenocivitas commented Feb 27, 2017

If the suggested fix is to nvm use --delete-prefix vx.x.x, what if --delete-prefix is configurable?
I added that line to my .bash_profile so I end up with the node version I need to use.

May be I'm misunderstanding and should not nvm use --delete-prefix vx.x.x?

I was just thinking in something that let you delete-prefix at .nvmrc level, some kind of flag or similar. 🤷‍♂️ (that will make it easier to deal inside scripts)

@ljharb
Copy link
Member

@ljharb ljharb commented Feb 27, 2017

@elmorenocivitas --delete-prefix should be a command that's only needed once, and manually, after that your machine ideally never has a prefix to delete again :-)

@elmorenocivitas
Copy link

@elmorenocivitas elmorenocivitas commented Feb 27, 2017

@ljharb for some reason it's necessary all the times here.
I'll double check the discussion above to see what's the issue.

Thanks for the fast answer!

PeterDaveHello added a commit to PeterDaveHello/nvm that referenced this issue Nov 4, 2017
Since markdown-link-check hasn't support relative links, to make the
test passed, move this link to use absolute URL so that we can introduce
the new test. cc tcort/markdown-link-check#10
@daviswhitehead
Copy link

@daviswhitehead daviswhitehead commented May 1, 2019

I followed this comment to solve my issue.
#1245 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants