hyperupcall / autoenv

Directory-based environments.
MIT License
5.62k stars 264 forks source link

Odd behavior with nvm installed #194

Open kingofsevens opened 4 years ago

kingofsevens commented 4 years ago

I am using the git version where #189 merged. And I am also using nvm with .nvrmc in some folders with or without .env in them.

When I cd to a folder with .nvmrc defined with a node version in it and it is different from the default version. I see the below outcome.

~/yyy $ cd dev
Found '/Users/xxx/yyy/dev/.nvmrc' with version <12.18.1>
Now using node v12.18.1 (npm v6.14.5)
shasum: Now using node v10.19.0 (npm v6.13.4): 
autoenv_source:.:6: no such file or directory: Now using node v10.19.0 (npm v6.13.4)
shasum: Reverting to nvm default version: 
autoenv_source:.:6: no such file or directory: Reverting to nvm default version
~/yyy/dev $

Even though I receive the above error, nvm uses the correct version.

~/yyy/dev $ node --version
v12.18.1
~/yyy/dev $ cd ..
Reverting to nvm default version
Now using node v10.19.0 (npm v6.13.4)
~/yyy $ node --version
v10.19.0

And no error reverting to old version when changing to parent folder.

jadenlemmon commented 2 years ago

Having the same issue 😢

hyperupcall commented 2 years ago

Hmm, I just tried to repo, but unfortunately, I did not get the same issue

I have an empty directory with .nvmrc containing v16.0.0, with the default nvm version being v12.18.1. cd'ing into the directory does nothing. I have to use nvm use to actually change the version

$ nvm use
Found '/.../repos/Groups/Bash/autoenv/.hidden/dir/.nvmrc' with version <v16.0.0>
Now using node v16.0.0 (npm v7.10.0)

Is anyone using nvm in a special way? I checked and it seemed that by default, it does not change the node verison when cding. So I'm not sure how you end up getting your error by default - do you define cd or chdir yourself in your ~./bashrc before sourcing nvm or autoenv?

reintroducing commented 2 years ago

I'm having the same issue. I have nvm automatically loading the defined version of node in my .zshrc file set up. In my .env file of my project i also have source env/bin/activate. This produces the following:

Found '/Users/mprzybylski/Work/patientpattern/.nvmrc' with version <17.9.0>
Now using node v17.9.0 (npm v8.5.5)
shasum: Now using node v16.13.0 (npm v8.1.0): No such file or directory
autoenv_source:.:6: no such file or directory: Now using node v16.13.0 (npm v8.1.0)
shasum: /Users/mprzybylski/Work/patientpattern/.envReverting to nvm default version: No such file or directory
autoenv_source:.:6: no such file or directory: /Users/mprzybylski/Work/patientpattern/.envReverting to nvm default version