Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

640
Views
Error: Cannot find module 'browserslist' when I run the npm run build

I'm using latest version of react-scripts npm package i.e. 4.0.3 in my react project and it has a vulnerabilities with one of his dependency package called browserslist, I was trying to resolve this vulnerability by adding this package under the resolutions section in my package.json file. I tried to override the package version with the help of preinstall command npx npm-force-resolutions and it will install the version we specified under the resolutions. My package.json file will be

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "react-scripts start",
    "preinstall": "npx npm-force-resolutions",
    "build": "react-scripts build"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "react-scripts": "^4.0.3"
  },
  "resolutions": {
    "browserslist": "4.16.6"
  }
}

  1. When I run the npm install the preinstall script will run and it will installing the browserslist package version after that I tried to check the list available vulnerabilities with npm audit command and I got 0 vulnerabilities. Refer https://i.stack.imgur.com/cp1Sf.png to install command view. Refer https://i.stack.imgur.com/8dLJz.png to audit command view

  2. After that I tried to run the npm run build command and it will took build script from my package.json file. The build is failing with following error. Refer https://i.stack.imgur.com/Lt3OE.png to build command view

I did lot of research on this from past 2 weeks but no luck at all. I'm definitely missing something after this. It would be great if anyone can help me on this it will be really appreciate.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Run this in your terminal:

npm i browserslist
over 4 years ago · Santiago Trujillo Report

0

Delete your nodemodules folder and package.lock.json file and run npm install.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!