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

Error: Cannot find module 'commander' #76

Open
1 task done
eng618 opened this issue May 10, 2018 · 5 comments
Open
1 task done

Error: Cannot find module 'commander' #76

eng618 opened this issue May 10, 2018 · 5 comments

Comments

@eng618
Copy link

eng618 commented May 10, 2018

When changing into a directory with a .node-version file I get the following error.

11:26:36 ▶ cd kibana
module.js:549
    throw err;
    ^

Error: Cannot find module 'commander'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/engarcia/.avn/bin/_avn:5:15)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

I've installed avn via yarn which worked fine previously. I've tried blowing out avn with rm -r ~/.avn and reinstalling as well with yarn global add avn avn-nvm to no avail.

Details

  • avn avn --version - 0.2.3
  • node node --version - 8.11.1
  • nvm nvm --version - 0.33.8
  • n n --version - na
  • zsh zsh --version - na
  • bash bash --version - 4.4.19(1)-release

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

11:24:48 ▶ __avn_debug
module.js:549
    throw err;
    ^

Error: Cannot find module 'commander'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/engarcia/.avn/bin/_avn:5:15)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

avn is loaded in my ~/.bashrc 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
@wbyoung
Copy link
Owner

wbyoung commented May 10, 2018

Does it work when installed via npm?

@eng618
Copy link
Author

eng618 commented May 11, 2018

just ran...

yarn global remove avn avn-nvm
npm i -g avn avn-nvm
avn setup

then changed into a dir with a .node-version file and got the same error:

module.js:549
    throw err;
    ^

Error: Cannot find module 'commander'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/engarcia/.avn/bin/_avn:5:15)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

and debug:

19:51:48 ▶ __avn_debug
module.js:549
    throw err;
    ^

Error: Cannot find module 'commander'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/engarcia/.avn/bin/_avn:5:15)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

and that was with node --version: v8.11.1

@clintandrewhall
Copy link

I was able to resolve this by running npm install in ~/.avn.

@rfgamaral
Copy link

I was able to resolve this by running npm install in ~/.avn.

I had a similar issue and while doing this solved the initial issue it presented a new one. I believe that using Yarn (which I used) didn't properly install avn-n and avn-nvm because they don't include any binaries.

I've since removed everything and globally installed avn, avn-n and avn-nvm with npm instead and I had no issues so far.

@JohnRDOrazio
Copy link

As @rfgamaral suggested, after having attempted to install using yarn, and running into all kinds of issues, I removed using yarn global remove avn avn-nvm avn-n. After exiting and restarting the terminal I was able to run npm install -g avn avn-nvm avn-n followed by avn setup without any trouble. Now when switching into a directory with a .node-version file I am no longer having any trouble.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants