'npm run build successfully locally with npm audit fix. But how on Netlify?

I have done my client coding and wanted to build on Netlify. However, when I run build locally, I got error and have no clue of the TypeError.

snapshot of the terminal

So I run npm audit fix --force as instructed, and then npm run build, it succeeded.

My question is : how to fix the dependencies when deploying on Netlify or Vercel?

my package.json:

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@apollo/client": "^3.5.10",
    "@emotion/react": "^11.8.2",
    "@emotion/styled": "^11.8.1",
    "@mui/icons-material": "^5.5.1",
    "@mui/material": "^5.5.3",
    "@testing-library/jest-dom": "^5.16.3",
    "@testing-library/react": "^12.1.4",
    "@testing-library/user-event": "^13.5.0",
    "apollo-link-context": "^1.0.20",
    "graphql": "^16.3.0",
    "graphql-tag": "^2.12.6",
    "jwt-decode": "^3.1.2",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-moment": "^1.1.1",
    "react-router-dom": "^6.2.2",
    "react-scripts": "5.0.0",
    "semantic-ui-css": "^2.4.1",
    "semantic-ui-react": "^2.1.2",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "proxy": "https://fathomless-mountain-12345.herokuapp.com/"
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source