question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When switching directories, first compare current and target Node version before proceeding, and abort AVN activation if they are the same

See original GitHub issue

Thanks for the great free software.

My project uses multiple different repositories, and each has their own individual directory locally. When I change to one directory, avn sets up the version of node per the .node-version file in the target directory. This is desirable.

However, when I change to another directory which contains another .node-version file having exactly the same contents, avn once again goes through the setup process.

I suggest that when changing directories and switching node versions, avn should, before proceeding with anything else, compare the current and target versions of Node, and if they are the same, then abort the setup process rather than forcing the user to wait a few seconds.

Here is some sample output:

hyperion:project chad$ cd api
avn activated 8.6.0 (avn-nvm v8.6.0)
hyperion:api chad$ cd ../app
avn activated 8.6.0 (avn-nvm v8.6.0)
hyperion:app chad$ cd ../admin
avn activated 8.6.0 (avn-nvm v8.6.0)
hyperion:admin chad$ 

As you can see, Node 8.6.0 was unnecessarily activated multiple times.

Details

  • avn 0.2.3
  • node 8.6.0
  • nvm 0.33.8
  • zsh zsh 5.3 (x86_64-apple-darwin17.0)
  • bash GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17)

The output of __avn_debug in the directory with a .node-version file is:

avn activated 8.6.0 (avn-nvm v8.6.0)
nvm use v8.6.0 > /dev/null;

avn is loaded in my ~/.{bash|zsh}{_profile|rc} file with:

[[ -s "$HOME/.avn/bin/avn.sh" ]] && source "$HOME/.avn/bin/avn.sh" # load avn

nvm specific

  • As an nvm user I am confirming that I did not install with Homebrew

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:10
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rfgamaralcommented, Oct 10, 2019

Came here to support this issue because I just noticed this happening on my machine. It’s a bit pointless to try to activate a version that it’s currently in use. In my particular machine takes a few seconds to switch, which is cumbersome when the versions are the same and there’s not need for switching.

0reactions
wufeihuangcommented, Jun 4, 2020

Uhm…I didn’t think about such a situation of using both n and nvm. Thanks for explaining.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Switching between Node versions during development
We compare and contrast two popular Node version managers that can help you more easily switch between Node versions during development.
Read more >
Automatically switch to correct version of Node based on project
Looks for a .nvmrc file in your current directory, every time you cd . If one is found, it loads the version via...
Read more >
Node Version Manager (nvm) for Windows [ Copied from ...
Uninstall any existing versions of Node.js before installing NVM for Windows (otherwise you'll have conflicting versions).
Read more >
Thyroid Disease and Thyroid Cancer - YouTube
Dr. Jonathan George looks at the thyroid physiology and disorders. Recorded on 03/09/2016. [6/2016] [Show ID: 30690]Please Note: Knowledge ...
Read more >
NCI Dictionary of Cancer Terms
An abbreviation for a chemotherapy combination used with radiation therapy to treat childhood Hodgkin lymphoma. It includes the drugs doxorubicin ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found