title: How to fix 'npm ERR! Cannot read property 'startsWith' of null'
body: <p>I am creating my first react-native app. I am attempting to install the react-native command line interface as shown <a href="https://facebook.github.io/react-native/docs/getting-started" rel="nofollow noreferrer">here</a>. I keep getting an error when I type the command to initiate the react-native command line</p>
  
  <ul>
  <li>OS: Windows 10</li>
  <li>Node: 10.15.3</li>
  <li>npm: 6.4.1</li>
  <li><p>I am not behind a proxy </p></li>
  <li><p>I have removed the http and https environment variables</p></li>
  <li>Updating node and npm creates a different error as shown <a href="https://stackoverflow.com/questions/55678569/how-to-fix-npm-does-not-support-node-js-v11-14-0-error-on-windows/55679257#55679257">here</a></li>
  </ul>
  
  <p>Here's the error</p>
  
  <pre><code>C:\&gt;npm install -g react-native-cli
  npm ERR! Cannot read property 'startsWith' of null
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     C:\Users\dnort\AppData\Roaming\npm-cache\_logs\2019-04-15T09_52_28_346Z-debug.log
  </code></pre>
  
  <p>Here's npm get registry </p>
  
  <pre><code>C:\&gt;npm get registry
  https://registry.npmjs.org/
  </code></pre>
  
  <p>Here's npm config get proxy </p>
  
  <pre><code>C:\&gt;npm config get proxy
  null
  </code></pre>
  
  <p>Here's npm config get http-proxy</p>
  
  <pre><code>C:\&gt;npm config get http-proxy
  undefined
  </code></pre>
  
  <p>Here's npm config get https-proxy</p>
  
  <pre><code>C:\&gt;npm config get https-proxy
  null
  </code></pre>
  
  <p>Here's the log file</p>
  
  <pre><code>0 info it worked if it ends with ok
  1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
  1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
  1 verbose cli   'install',
  1 verbose cli   '-g',
  1 verbose cli   'react-native-cli' ]
  2 info using npm@6.4.1
  3 info using node@v10.15.3
  4 verbose npm-session 8e6a6f9ef2e9298d
  5 silly install loadCurrentTree
  6 silly install readGlobalPackageData
  7 silly fetchPackageMetaData error for react-native-cli@latest Cannot read property 'startsWith' of null
  8 timing stage:rollbackFailedOptional Completed in 7ms
  9 timing stage:runTopLevelLifecycles Completed in 1811ms
  10 verbose stack TypeError: Cannot read property 'startsWith' of null
  10 verbose stack     at getProxy (C:\Program Files\nodejs\node_modules\npm\node_modules\make-fetch-happen\agent.js:164:25)
  10 verbose stack     at getAgent (C:\Program Files\nodejs\node_modules\npm\node_modules\make-fetch-happen\agent.js:37:19)
  10 verbose stack     at remoteFetch (C:\Program Files\nodejs\node_modules\npm\node_modules\make-fetch-happen\index.js:310:17)
  10 verbose stack     at opts.cacheManager.match.then.res (C:\Program Files\nodejs\node_modules\npm\node_modules\make-fetch-happen\index.js:172:14)
  10 verbose stack     at tryCatcher (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
  10 verbose stack     at Promise._settlePromiseFromHandler (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31)
  10 verbose stack     at Promise._settlePromise (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
  10 verbose stack     at Promise._settlePromise0 (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
  10 verbose stack     at Promise._settlePromises (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
  10 verbose stack     at Promise._fulfill (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:638:18)
  10 verbose stack     at Promise._resolveCallback (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:432:57)
  10 verbose stack     at Promise._settlePromiseFromHandler (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:524:17)
  10 verbose stack     at Promise._settlePromise (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
  10 verbose stack     at Promise._settlePromise0 (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
  10 verbose stack     at Promise._settlePromises (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
  10 verbose stack     at Promise._fulfill (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:638:18)
  11 verbose cwd C:\
  12 verbose Windows_NT 10.0.17134
  13 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "react-native-cli"
  14 verbose node v10.15.3
  15 verbose npm  v6.4.1
  16 error Cannot read property 'startsWith' of null
  17 verbose exit [ 1, true ]
  </code></pre>
  
  <p>I expect to install the react-native command line to be able to initiate react-native projects.</p>
  
  <p><strong>EDIT</strong> 
  Please see the npm config ls -l input below</p>
  
  <pre><code>C:\Windows\System32&gt;npm config ls -l
  ; cli configs
  long = true
  metrics-registry = "https://registry.npmjs.org/"
  scope = ""
  user-agent = "npm/6.4.1 node/v10.15.3 win32 x64"
  
  ; userconfig C:\Users\dnort\.npmrc
  https-proxy = null
  proxy = null
  strict-ssl = false
  
  ; builtin config undefined
  prefix = "C:\\Users\\dnort\\AppData\\Roaming\\npm"
  
  ; default values
  access = null
  allow-same-version = false
  also = null
  always-auth = false
  audit = true
  audit-level = "low"
  auth-type = "legacy"
  bin-links = true
  browser = null
  ca = null
  cache = "C:\\Users\\dnort\\AppData\\Roaming\\npm-cache"
  cache-lock-retries = 10
  cache-lock-stale = 60000
  cache-lock-wait = 10000
  cache-max = null
  cache-min = 10
  cafile = undefined
  cert = null
  cidr = null
  color = true
  commit-hooks = true
  depth = null
  description = true
  dev = false
  dry-run = false
  editor = "notepad.exe"
  engine-strict = false
  fetch-retries = 2
  fetch-retry-factor = 10
  fetch-retry-maxtimeout = 60000
  fetch-retry-mintimeout = 10000
  force = false
  git = "git"
  git-tag-version = true
  global = false
  global-style = false
  globalconfig = "C:\\Users\\dnort\\AppData\\Roaming\\npm\\etc\\npmrc"
  globalignorefile = "C:\\Users\\dnort\\AppData\\Roaming\\npm\\etc\\npmignore"
  group = 0
  ham-it-up = false
  heading = "npm"
  https-proxy = null
  if-present = false
  ignore-prepublish = false
  ignore-scripts = false
  init-author-email = ""
  init-author-name = ""
  init-author-url = ""
  init-license = "ISC"
  init-module = "C:\\Users\\dnort\\.npm-init.js"
  init-version = "1.0.0"
  json = false
  key = null
  legacy-bundling = false
  link = false
  local-address = undefined
  loglevel = "notice"
  logs-max = 10
  ; long = false (overridden)
  maxsockets = 50
  message = "%s"
  ; metrics-registry = null (overridden)
  node-options = null
  node-version = "10.15.3"
  noproxy = null
  offline = false
  onload-script = null
  only = null
  optional = true
  otp = null
  package-lock = true
  package-lock-only = false
  parseable = false
  prefer-offline = false
  prefer-online = false
  ; prefix = "C:\\Program Files\\nodejs" (overridden)
  preid = ""
  production = false
  progress = true
  proxy = null
  read-only = false
  rebuild-bundle = true
  registry = "https://registry.npmjs.org/"
  rollback = true
  save = true
  save-bundle = false
  save-dev = false
  save-exact = false
  save-optional = false
  save-prefix = "^"
  save-prod = false
  scope = ""
  script-shell = null
  scripts-prepend-node-path = "warn-only"
  searchexclude = null
  searchlimit = 20
  searchopts = ""
  searchstaleness = 900
  send-metrics = false
  shell = "C:\\WINDOWS\\system32\\cmd.exe"
  shrinkwrap = true
  sign-git-commit = false
  sign-git-tag = false
  sso-poll-frequency = 500
  sso-type = "oauth"
  ; strict-ssl = true (overridden)
  tag = "latest"
  tag-version-prefix = "v"
  timing = false
  tmp = "C:\\Users\\dnort\\AppData\\Local\\Temp"
  umask = 0
  unicode = false
  unsafe-perm = true
  update-notifier = true
  usage = false
  user = 0
  ; user-agent = "npm/{npm-version} node/{node-version} {platform} {arch}" (overridden)
  userconfig = "C:\\Users\\dnort\\.npmrc"
  version = false
  versions = false
  viewer = "browser"
  </code></pre>