commander.Command Error

(Hakuna Matata) #1

So I am trying to create a react app on localhost. The plan is to containerize is later.

Here is my setup -

Ubuntu 16.04
Node - v10.15.3
NPM - 6.4.1

I was able to create empty react project

vagrant@docubu:/vagrant/lab$ sudo npm install -g create-react-app
/usr/bin/create-react-app -> /usr/lib/node_modules/create-react-app/index.js
+ create-react-app@3.0.0
updated 1 package in 9.61s

But I am running into below error while I tried creating react app

vagrant@docubu:/vagrant/lab$ create-react-app react1
const program = new commander.Command(

TypeError: commander.Command is not a constructor
    at Object.<anonymous> (/usr/lib/node_modules/create-react-app/createReactApp.js:66:17)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/usr/lib/node_modules/create-react-app/index.js:58:1)
    at Module._compile (internal/modules/cjs/loader.js:701:30)

What am I missing here? Tried posting this on git hub of react-app. No luck :(

I am a sysadmin and aspirant devops. Not a coder/developer. So keep your answers bit basic. :P

(John Gee) #2

(I don’t think this is an npm question as such, and have moved to #community:javascript.)

Thanks for supplying reproduction steps here, and not just linking to elsewhere.

Optional: slightly surprised you didn’t get an answer from git hub of react-app. Could you post a link for interest?

(John Gee) #3

Found the link, first hit when I went searching!

(Hakuna Matata) #4

Yep…even i am bit surprised for my attempt on github (react)

Any who, hopefully someone can help me here.

BTW, I am using a vagrant image for Ubuntu. But I guess that shouldn’t be an issue.

(John Gee) #5

I was not able to reproduce the problem on Mac. (But probably not surprising, if it was that easy…)

I wonder if it is a broken install of create-react-app, could you check whether commander has been installed as a dependency of create-react-app?

cd /usr/lib/node_modules/create-react-app
npm ls | grep commander
(Hakuna Matata) #6

NB - Writing this from my gmail directly.

Yep. the commander is present.

vagrant@docubu:/usr/lib/node_modules/create-react-app$ ls -l

total 464

-rwxr-xr-x  1 vagrant vagrant  28130 Oct 26  1985 createReactApp.js

-rwxr-xr-x  1 vagrant vagrant   1889 Oct 26  1985 index.js

-rw-r--r--  1 vagrant vagrant   1080 Oct 26  1985 LICENSE

drwxr-xr-x 86 root    root      4096 May 10 03:31 node_modules

-rw-r--r--  1 vagrant vagrant   1770 May 10 03:31 package.json

-rw-r--r--  1 vagrant vagrant    407 Oct 26  1985

-rw-r--r--  1 vagrant vagrant 424489 Oct 26  1985 yarn.lock.cached

vagrant@docubu:/usr/lib/node_modules/create-react-app$ npm ls | grep commander

├── commander@2.19.0
(Hakuna Matata) #7

*** SOVLED *****

Just purged the whole nodejs. Manually removed the node_modules folder.

reinstalled nodejs from package manger.

After this -

in first step while creating emply react application, got error like

npm ERR! Invalid response body while trying to fetch Integrity verification failed for Hash {


vagrant@docubu:/vagrant/lab$ sudo npm cache clear --force

And bob’s your uncle!

1 Like
(John Gee) #8

Great, glad you solved it, and thanks for update.

(system) closed #9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.