Unable to Update BrowserList with NPM

302 views Asked by At

When I try to update my Browser list with npx update-browserslist-db@latest I get an error message.

/home/tburton/.npm/_npx/2662cbd72e57abb6/node_modules/update-browserslist-db/cli.js:39
      throw e
      ^

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at getLatestInfo (/home/tburton/.npm/_npx/2662cbd72e57abb6/node_modules/update-browserslist-db/index.js:73:15)
    at updateDB (/home/tburton/.npm/_npx/2662cbd72e57abb6/node_modules/update-browserslist-db/index.js:267:16)
    at Object.<anonymous> (/home/tburton/.npm/_npx/2662cbd72e57abb6/node_modules/update-browserslist-db/cli.js:34:5)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
    at Function.Module._load (node:internal/modules/cjs/loader:911:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47

I've tried clearing my cache with npm cache clean --force and updating to the lastest NPM version. I still get the same error.

I've also tried updating my browserslist config in package.json,

Current package.json settings:

  "browserslist": [
      "> 0.2%",
      "not dead",
      "last 2 chrome version",
      "last 2 firefox version",
      "last 2 safari version"
  ],

Something must be corrupted on my machine. What is it, and how do I fix it?

1

There are 1 answers

0
Raystorm On

Turns out my react app had browserslist and caniuse-lite transitive dependencies. I guess the fix was npm update browserslist caniuse-lite or however that command is supposed to go. I made the mistake of not specifying packages so now I am still sorting out other errors, but I'm not longer getting build warnings about updating my browser list settings.