avn icon indicating copy to clipboard operation
avn copied to clipboard

Switching from node v16.5.0 causes error Fatal Error: Cannot find module '/Users/apple/.avn/plugins/avn-nvm'

Open Olgagr opened this issue 2 years ago • 3 comments

I'm using n as my node version manager. When I'm on version 16.5.0 and I go to the project with lower version eg. 6.7.0 or 10.4.1 I get an error:

Fatal Error: Cannot find module '/Users/apple/.avn/plugins/avn-nvm'

Indeed, I don't have avn-nvm plugin installed as I'm not using nvm.

Details

  • avn 0.2.4
  • node 16.5.0
  • n 6.6.0
  • bash 3.2.57(1)-release (x86_64-apple-darwin19)

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

Fatal Error: Cannot find module '/Users/apple/.avn/plugins/avn-nvm'
Require stack:
- /Users/apple/.avn/lib/plugins.js
- /Users/apple/.avn/lib/hooks.js
- /Users/apple/.avn/lib/avn.js
- /Users/apple/.avn/index.js
- /Users/apple/.avn/bin/_avn
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:927:15)
    at Function.Module._load (node:internal/modules/cjs/loader:772:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at /Users/apple/.avn/lib/plugins.js:59:20
    at tryCatcher (/Users/apple/.avn/node_modules/bluebird/js/release/util.js:16:23)
    at Object.gotValue (/Users/apple/.avn/node_modules/bluebird/js/release/reduce.js:168:18)
    at Object.gotAccum (/Users/apple/.avn/node_modules/bluebird/js/release/reduce.js:155:25)
    at Object.tryCatcher (/Users/apple/.avn/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/apple/.avn/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/Users/apple/.avn/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/Users/apple/.avn/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/Users/apple/.avn/node_modules/bluebird/js/release/promise.js:729:18)
    at _drainQueueStep (/Users/apple/.avn/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/Users/apple/.avn/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/Users/apple/.avn/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/apple/.avn/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (node:internal/timers:464:21)

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

Olgagr avatar Jul 30 '21 08:07 Olgagr

Looks like you need to install the plugin or update your config in ~/.avnrc to not try to load that plugin.

wbyoung avatar Jul 30 '21 14:07 wbyoung

@wbyoung This is what I thought. However, in my ~/.avnrc I have only:

{
  "plugins": ["n"]
}

Moreover, when I'm switching from lower version of node, eg. 10.x I don't have an issue.

Olgagr avatar Aug 02 '21 07:08 Olgagr

I haven't worked on this in quite some time and haven't been writing code at all for a few years. So my suggestions at this point are:

  • Reinstall
  • Edit the code directly in the installed location to debug further

wbyoung avatar Aug 03 '21 01:08 wbyoung