0

I'm trying to deploy a react app I worked on and when I try to push to heroku master it says "failed to compile node.js". Now I've already tried to specify what node I'm using and update to the lastest parser link, but still getting an error.

Here is what I'm getting in the terminal:

-----> Build
       Running heroku-postbuild
       
       > potato-network@1.0.0 heroku-postbuild /tmp/build_82788311
       > cd client && npm install && npm run build
       
       
       > core-js@3.25.4 postinstall /tmp/build_82788311/client/node_modules/core-js
       > node -e "try{require('./postinstall')}catch(e){}"
       
       
       > core-js-pure@3.25.4 postinstall /tmp/build_82788311/client/node_modules/core-js-pure
       > node -e "try{require('./postinstall')}catch(e){}"
       
       added 1429 packages from 795 contributors and audited 1434 packages in 21.79s
       
       211 packages are looking for funding
         run `npm fund` for details
       
       found 1 high severity vulnerability
         run `npm audit fix` to fix them, or `npm audit` for details
       
       > client@0.1.0 build /tmp/build_82788311/client
       > react-scripts build
       
       Creating an optimized production build...
       Failed to compile.
       
       [eslint] Must use import to load ES Module: /tmp/build_82788311/client/node_modules/@eslint/eslintrc/universal.js
       require() of ES modules is not supported.
       require() of /tmp/build_82788311/client/node_modules/@eslint/eslintrc/universal.js from /tmp/build_82788311/client/node_modules/eslint/lib/linter/linter.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
       Instead rename universal.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /tmp/build_82788311/client/node_modules/@eslint/eslintrc/package.json.
       
       
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the client@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npmcache.h5MIg/_logs/2022-10-03T00_22_02_904Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! potato-network@1.0.0 heroku-postbuild: `cd client && npm install && npm run build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the potato-network@1.0.0 heroku-postbuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npmcache.h5MIg/_logs/2022-10-03T00_22_02_911Z-debug.log
-----> Build failed

Here is my package.json file:

{
  "name": "client",
  "proxy": "http://localhost:5000",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.9",
    "@testing-library/react": "^11.2.3",
    "@testing-library/user-event": "^12.6.2",
    "axios": "^0.21.1",
    "express": "^4.18.1",
    "moment": "^2.29.1",
    "peerjs": "^1.3.2",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-redux": "^7.2.2",
    "react-router-dom": "^5.2.0",
    "react-scripts": "^5.0.1",
    "react-share": "^4.3.1",
    "redux": "^4.0.5",
    "redux-devtools-extension": "^2.13.8",
    "redux-thunk": "^2.3.0",
    "socket.io-client": "^3.1.2",
    "web-vitals": "^0.2.4"
  },
  "devDependencies": {
    "@babel/eslint-parser": "^7.5.4",
    "babel-eslint": "^10.0.2",
    "eslint": "^8.24.0",
    "eslint-plugin-react": "^7.31.8"
  },
  "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"
    ]
  }
}

Here is my .eslinct.js:

  env: {
    browser: true,
    es2021: true,
  },
  parser: "@babel/eslint-parser",
  extends: ["eslint:recommended", "plugin:react/recommended"],
  overrides: [],
  parserOptions: {
    ecmaVersion: "latest",
    requireConfigFile: false,
    sourceType: "module",
  },
  plugins: ["react"],
  rules: {},

How can I fix it? Googling the error does not present any useful forums or raised bugs.

0 Answers0