Skip to content
This repository was archived by the owner on Dec 6, 2023. It is now read-only.
This repository was archived by the owner on Dec 6, 2023. It is now read-only.

Error loading plugins in node v12, prevents activation of correct node #95

@percyhanna

Description

@percyhanna

I believe this is a bug in avn, but I'm not 100% certain.

It seems that Node v12 (or some other version) has changed the message format for the require exception message, such that this regex no longer works.

If the current version of Node is v12, the plugin loading code fails to run properly. If I switch to an older version, e.g. nvm use 8 and then try to cd into the directory, it works fine.

I will open a PR for a potential fix.

Details

  • avn 0.2.4
  • node v12.14.1
  • nvm 0.35.2
  • bash 3.2.57(1)

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

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

avn is loaded in my ~/.bash_profile} 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions