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

322
Views
Errors when running app on server port 5000, Uncaught SyntaxError: Unexpected token '<' and Manifest: Line: 1, column: 1, Syntax error

I'm building a portfolio with a contact form in React (create-react-app). I need a bit of backend for that so the user can send a message to my emailaddress. All works fine. But now I want to deploy the app to the web with heroku. However when I run a test by trying to run the app on the server port localhost:5000 I get these two errors shown in the title, and a blank document
Uncaught SyntaxError: Unexpected token '<'
Manifest: Line: 1, column: 1, Syntax error.

My manifest.json file looks ok. Could it be that the css files are not found in the static folder?

Project folder structure

app structure

The server

const express = require('express')
const router = express.Router()
const cors = require('cors')
const nodemailer = require('nodemailer')
const hbs = require('nodemailer-express-handlebars')
const path = require('path')
const colors = require('colors')
const bcrypt = require('bcrypt');
const dotenv = require('dotenv')

const PORT = process.env.REACT_APP_PORT || 5000

const app = express()
app.use(cors())
dotenv.config()
app.use(express.json())

app.use(express.static(path.join(__dirname, '../myportfolio/build')))
app.get('*', (req, res) => {
    res.sendFile(path.resolve(__dirname, '../myportfolio', 'build', 'index.html'))
})

//removed nodemailer code

app.listen(PORT, () => console.log(`Server up and running in ${process.env.REACT_APP_NODE_ENV} 
on port ${PORT} !`.yellow))

My manifest.json

{
  "short_name": "Portfolio",
  "name": "my name,  Portfolio",
   "icons": [
{
  "src": "discoballicon.ico",
  "sizes": "64x64 32x32 24x24 16x16",
  "type": "image/x-icon"
},
{
  "src": "logo192.png",
  "type": "image/png",
  "sizes": "192x192"
},
{
  "src": "logo512.png",
  "type": "image/png",
  "sizes": "512x512"
}
],
  "start_url": ".",
  "display": "standalone",
  "theme_color": "#000000",
  "background_color": "#ffffff"
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Problem solved, found the answer on github here:
https://github.com/facebook/create-react-app/issues/1812
When running npm build you can see this:

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


The problem was an incorrect path on the server. It looked like this:

app.use(express.static(path.join(__dirname, '../frontend/build/static')))

It had to be:

app.use('/showcaseportfolio', express.static(path.join(__dirname, '../frontend/build')))

Now it runs on localhost:5000/portfolio

about 4 years ago · Juan Pablo Isaza 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!