browserslist / update-db

CLI tool to update caniuse-lite to refresh target browsers from Browserslist config
https://browsersl.ist/
MIT License
286 stars 57 forks source link

update-db fails #15

Closed rwb196884 closed 1 year ago

rwb196884 commented 1 year ago
PS > yarn run build
yarn run v1.22.19
$ react-scripts build
Creating an optimized production build...
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Compiled successfully.

File sizes after gzip:

  615.89 KB  build\static\js\2.489004bb.chunk.js
  44.42 KB   build\static\js\main.ee38daab.chunk.js
  6.85 KB    build\static\css\2.3670e0c2.chunk.css
  774 B      build\static\js\runtime-main.8c40394c.js

The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.
You may serve it with a static server:

  yarn global add serve
  serve -s build

Find out more about deployment here:

  bit.ly/CRA-deploy

Done in 31.16s.
PS > npx browserslist@latest --update-db
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
C:\blah\client\node_modules\browserslist\update-db.js:49
    if (match[1]) return match[1]
             ^

TypeError: Cannot read properties of null (reading '1')
    at getCurrentVersion (C:\blah\client\node_modules\browserslist\update-db.js:49:14)
    at updateDB (C:\blah\client\node_modules\browserslist\update-db.js:119:17)
    at Object.<anonymous> (C:\blah\client\node_modules\browserslist\cli.js:40:3)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47
PS >
ai commented 1 year ago

The problem is because you are using old version of Browserslist.

Call npx update-browserslist-db@latest instead of npx browserslist@latest --update-db

Then I recommend updating browserslist.

rwb196884 commented 1 year ago

How am I using browserlist?

"dependencies": {
    "@fortawesome/fontawesome-svg-core": "^6.3.0",
    "@fortawesome/free-brands-svg-icons": "^6.3.0",
    "@fortawesome/free-solid-svg-icons": "^6.3.0",
    "@fortawesome/react-fontawesome": "^0.2.0",
    "@microsoft/applicationinsights-react-js": "^3.0.4",
    "@microsoft/applicationinsights-web": "^2.5.9",
    "caniuse-lite": "^1.0.30001462",
    "devextreme": "^22.2.4",
    "devextreme-react": "^22.2.4",
    "downshift": "^6.0.6",
    "fluentvalidation-ts": "^2.1.5",
    "formik": "^2.1.4",
    "framer-motion": "^2.9.4",
    "lodash": "^4.17.21",
    "oidc-client": "1.11.5",
    "query-string": "^6.12.1",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-inlinesvg": "^2.2.2",
    "react-router-dom": "^5.2.0",
    "react-router-last-location": "^2.0.1",
    "react-scripts": "4.0.3",
    "react-slick": "^0.25.2",
    "react-spinners": "^0.9.0",
    "react-swipeable": "^5.5.1",
    "react-toastify": "^6.1.0",
    "react-use-scroll-position": "^2.0.0",
    "remove": "^0.1.5",
    "slick-carousel": "^1.8.1",
    "styled-components": "^5.3.8",
    "superagent": "^8.0.9"
  },
  "devDependencies": {
    "@storybook/addon-actions": "^5.3.19",
    "@storybook/addon-links": "^5.3.19",
    "@storybook/addons": "^5.3.19",
    "@storybook/preset-create-react-app": "^3.0.0",
    "@storybook/react": "^5.3.19",
    "@testing-library/jest-dom": "^5.9.0",
    "@testing-library/react": "^10.0.4",
    "@testing-library/user-event": "^10.4.0",
    "@types/jest": "^25.2.3",
    "@types/lodash": "^4.14.153",
    "@types/node": "^14.0.5",
    "@types/react": "^16.9.35",
    "@types/react-dom": "^16.9.8",
    "@types/react-router-dom": "^5.1.5",
    "@types/react-slick": "^0.23.4",
    "@types/styled-components": "^5.1.0",
    "@types/superagent": "^4.1.7",
    "jest-environment-jsdom-sixteen": "^1.0.3",
    "nock": "^13.3.0",
    "prettier": "^2.8.4",
    "typescript": "^4.9.5"
  },
ai commented 1 year ago

Browserslist is a nested dependency in many tools like Autoprefixer or Babel. Just check your lock file.

The best way to update nested dependency is to use pnpm instead of yarn or npm. It has pnpm update -r browserslist.

rwb196884 commented 1 year ago

Can't find browserlist in yarn.lock.

ai commented 1 year ago

browserslist with S in the middle