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.

Error: Cannot find module 'commander'

See original GitHub issue

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

Issue Analytics

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

github_iconTop GitHub Comments

8reactions
clintandrewhallcommented, Oct 26, 2018

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

1reaction
rfgamaralcommented, Oct 10, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Cannot find module 'commander' - node.js
Most likely commander is missing from package.json . Install it and add it to package.json by doing: npm install commander --save.
Read more >
Error: Cannot find module 'commander' · Issue #688 · stedolan/jq
When I try to launch jq, it reports a missing dependency, commander. Trace: $ npm install -g jq $ jq module.js:340 throw err;...
Read more >
How to solve Cannot find module 'commander' error in Node.js?
The error "Cannot find module 'commander'" occurs when you use the commander package in your code without installing it in your project. ......
Read more >
Cannot find module commander in Node - rashid jorvee blog
To install the commander module you need to run the below npm install command. ... After executing the above command, the Node commander...
Read more >
How to resolve "Cannot find module" error in Node - Sabe.io
The Cannot find module error is a common error that usually happens when dependencies are not installed. Once you install your dependencies and ......
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