GetEnv.NoBoolean Error trying to start project with expo-cli

#1

I’m receiving the following error when trying to run my Expo project using the expo-cli start -c command

C:\Users\regin\AppData\Roaming\npm\node_modules\expo-cli\node_modules\getenv\lib\getenv.js:66
throw new Error(‘GetEnv.NoBoolean: ’ + value + ’ is not a boolean.’);

I’m using the following:
expo-cli 2.6.14
node 10.15.0
WIndows 10 build 17134.472

Trying to run the expo diagnostics command results in the same error.

Uninstalling expo-cli 2.6.14 and installing 2.4.0 lets me start the project successfully.

Trying to run expo diagnostics with 2.4.0 installed results in the following:

Expo CLI 2.4.0 environment info:
    System:
      OS: Windows 10
    Binaries:
      Yarn: 1.10.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
      npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD

  Diagnostics report:
|[19:03:24] Request body larger than maxBodyLength limit
[19:03:24] Error: Request body larger than maxBodyLength limit
    at RedirectableRequest.write (C:\Users\regin\AppData\Roaming\npm\node_modules\expo-cli\node_modules\follow-redirects\index.js:105:24)
    at RedirectableRequest.end (C:\Users\regin\AppData\Roaming\npm\node_modules\expo-cli\node_modules\follow-redirects\index.js:130:10)
    at dispatchHttpRequest (C:\Users\regin\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\adapters\http.js:271:11)
    at new Promise (<anonymous>)
    at httpAdapter (C:\Users\regin\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\adapters\http.js:20:10)
    at dispatchRequest (C:\Users\regin\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\core\dispatchRequest.js:59:10)
    at process._tickCallback (internal/process/next_tick.js:68:7)
#2

what shell are you using? git bash? powershell?

#3

@notbrent I’m using powershell

#4

@notbrent The issue does not happen when I used the bash shell in Windows Subsystem for Linux

#5

@notbrent The problem also happens when using the cmd shell in Windows. I’d stick with WSL, but the expo client on my device is unable to find the packager if I run expo start -c from the WSL bash shell.

here is the full error. As you can see it says that TRUE is not a boolean

C:\Users\regin\AppData\Roaming\npm\node_modules\expo-cli\node_modules\getenv\lib\getenv.js:66
        throw new Error('GetEnv.NoBoolean: ' + value + ' is not a boolean.');
        ^

Error: GetEnv.NoBoolean: TRUE is not a boolean.
    at Object.boolish (C:\Users\regin\AppData\Roaming\npm\node_modules\expo-cli\node_modules\getenv\lib\getenv.js:66:15)
    at Function.boolish (C:\Users\regin\AppData\Roaming\npm\node_modules\expo-cli\node_modules\getenv\lib\getenv.js:79:27)
    at Object.<anonymous> (C:\Users\regin\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js:11:14)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)

Here is the code that is being referenced in getenv.js

boolish: function(value) {
    try {
      return convert.bool(value)
    }
    catch(err) {
      var isBool = (value === '1' || value === '0' || );
      if (!isBool) {
        throw new Error('GetEnv.NoBoolean: ' + value + ' is not a boolean.'); //// Here is line 66
      }

      return (value === '1');
    }
  },

That code references the convert.bool function which looks like this

bool: function(value) {
    var isBool = (value === 'true' || value === 'false' || value === 'TRUE' || value === 'FALSE');
    if (!isBool) {
      throw new Error('GetEnv.NoBoolean: ' + value + ' is not a boolean.');
    }

    return (value === 'true')
  }

I’m not sure how the error is being caused since convert.bool specifically looks for TRUE as one of the satisfactory values.

This error is keeping me from doing any development since I can’t run the expo-cli. I’d appreciate any help.

#6

@notbrent I figured it out. For some reason the version of getenv.js packaged with expo-cli had

var isBool = (value === 'true' || value === 'false');

instead of

var isBool = (value === 'true' || value === 'false' || value === 'TRUE' || value === 'FALSE');

in the convert.bool function. I’m not sure why the version of getenv in my node_modules directory had the longer line. The code on GitHub has the shorter version.

#7

thanks for the info! can you post your findings to an issue on https://github.com/expo/expo-cli?

#8

Will do.

closed #9

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