hyperupcall/autoenv

Error with nvm on Mac

krokicki opened this issue · 2 comments

Platform

  • Operating system and version? macOS Catalina
  • Shell and version? GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
  • autoenv installation method: automated (with cURL), it used Brew
  • autoenv version: 0.3.0

Describe the bug

My .env file:

nvm use v16.14.2

The command works when executed manually. When it's executed by autoenv it throws this error and unsets the node environment entirely:

nvm is not compatible with the "NVM_NPM_CONFIG_PREFIX_ENV" environment variable: currently set to "NVM_NPM_CONFIG_PREFIX_ENV"
Run `unset NVM_NPM_CONFIG_PREFIX_ENV` to unset it.

Expected behavior

Expected to work the same way as manually invoking the command.

Additional context

I've no idea if this is an autoenv bug or nvm bug. Autoenv must be using a different environment compared to the shell, but I couldn't puzzle out what's different. I don't have any NVM or NPM variables set anywhere, or anything special configured.

I should add that I tried nvm's advice to run unset NVM_NPM_CONFIG_PREFIX_ENV and it didn't help. I also tried changing the .env file to clear it from the environment that nvm runs in:

NVM_NPM_CONFIG_PREFIX_ENV='' nvm use v16.14.2

Thank you for reporting! It seems there are multiple issues with NVM (issue #194).

I will take another stab at these issues in the coming days, and I'll see what i can find.