DEV Community

Discussion on: Causes of Heroku H10-App Crashed Error And How To Solve Them

Collapse
 
yordanovdna profile image
Iliyan Yordanov

Hey all,

I tried with npm install serve --s and replacing my scripts in package.json, but when tested both on my local machine and heroku while run npm run start, after build, I got an error:

serve -s build
(node:25496) ExperimentalWarning: The ESM module loader is experimental.
file:///D:/Projects/Projects-on-React/my-portfolio-website/node_modules/serve/build/main.js:129
url.port = url.port ?? "3000";
^
SyntaxError: Unexpected token '?'

However, if I run it manualy by typing serve -s build it works, but it uses an old version of serve@^6.14.6

I tried to install this verion and deploy to heroku but it's saying that there is no such a verion.

Any thoughts on what it could be, and maybe how I can solve this?

Thanks in advance!

Image description

My pachage.json:

{
  "name": "my-portfolio-website",
  "version": "0.1.0",
  "private": true,
  "engines": {
    "node": "v12.18.3"
  },
  "description": "Iliyan Yordanov portfolio website.",
  "author": {
    "name": "Iliyan Yordanov",
    "email": "iliyanyyordanov@gmail.com"
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^1.2.32",
    "@fortawesome/free-brands-svg-icons": "^5.15.1",
    "@fortawesome/free-regular-svg-icons": "^5.15.1",
    "@fortawesome/free-solid-svg-icons": "^5.15.1",
    "@fortawesome/react-fontawesome": "^0.1.11",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "ansi-regex": "^6.0.1",
    "axios": "^0.20.0",
    "bootstrap": "^4.5.3",
    "joi-browser": "^13.4.0",
    "jquery": "^3.5.1",
    "node-sass": "^4.14.1",
    "popper.js": "^1.16.1",
    "react": "^16.14.0",
    "react-dom": "^16.14.0",
    "react-helmet": "^6.1.0",
    "react-image-appear": "^1.3.26",
    "react-mail-form": "^2.1.0",
    "react-router-dom": "^5.2.0",
    "react-scripts": "3.4.3",
    "react-snapshot": "^1.3.0",
    "react-toastify": "^6.0.9",
    "serve": "^14.0.0"
  },
  "scripts": {
    "dev": "react-scripts start",
    "start": "serve -s build",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "heroku-postbuild": "npm run build"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Enter fullscreen mode Exit fullscreen mode