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

315
Views
Getting the Unexpected token < in JSON at position 31 on vscode and online IDE

I restarted working on my website and it keeps giving this error I'm not sure why because I never edited the package.json file. Btw I'm doing my project with react.

error that shows up whenever I do npm start or use codesandbox to run my code

this is my package.json file

{
  "name": "profile-project",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^6.1.1",
    "@fortawesome/free-brands-svg-icons": "^6.1.1",
    "@fortawesome/free-solid-svg-icons": "^6.1.1",
    "@fortawesome/react-fontawesome": "^0.1.18",
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "^13.1.1",
    "@testing-library/user-event": "^13.5.0",
    "bootstrap": "^5.1.3",
    "font-awesome": "^4.7.0",
    "react": "^18.0.0",
    "react-bootstrap": "^2.4.0",
    "react-dom": "^18.0.0",
    "react-icons": "^4.3.1",
    "react-router-dom": "6",
    "react-scripts": "5.0.1",
    "sass": "^1.51.0",
    "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"
    ]
  }
}

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I don't know much about your project, but that is the typical error given when something is expecting JSON and is given HTML instead. This commonly occurs when an API request is made incorrectly and an index.html is returned, the API is running PHP and it errors and gives an error message in HTML, etc.

If it worked before but doesn't now, then something must have changed. Browsers almost never break backwards compatibility, so it's most likely something in your project. Did you make absolutely no changes whatsoever since you last worked with it? (Not even a dependency update.)

Go through these steps, and let us know what happens:

  1. Are you sure you have not changed anything since it worked?
  2. Are there any error messages in the browser console?
  3. Does your project have any other components? If so, what are the contents of the components mentioned in that error message?
  4. Based on this, do you have a base tag in the head of your index.html or equivalent? E.g. <base href="/" />

Also maybe relevant: Webpack Issue #2541.

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!