Npm start error JSON

I have been working on a project that uses react, typescript, c#, and sql. Everything was running last night, but this morning when I go to restart my project with npm start it doesnt load and I get this error

SyntaxError: Unexpected token , in JSON at position 75346
    at JSON.parse (<anonymous>)
    at Object.getBuildInfo (C:\Users\codya\airlineservice\node_modules\typescript\lib\typescript.js:108782:21)
    at readBuilderProgram (C:\Users\codya\airlineservice\node_modules\typescript\lib\typescript.js:121325:28)
    at Object.createWatchProgram (C:\Users\codya\airlineservice\node_modules\typescript\lib\typescript.js:121480:26)
    at Object.<anonymous> (C:\Users\codya\airlineservice\node_modules\fork-ts-checker-webpack-plugin\lib\typescript-reporter\reporter\TypeScriptReporter.js:304:59)
    at Generator.next (<anonymous>)
    at C:\Users\codya\airlineservice\node_modules\fork-ts-checker-webpack-plugin\lib\typescript-reporter\reporter\TypeScriptReporter.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\codya\airlineservice\node_modules\fork-ts-checker-webpack-plugin\lib\typescript-reporter\reporter\TypeScriptReporter.js:4:12)
    at Object.getIssues (C:\Users\codya\airlineservice\node_modules\fork-ts-checker-webpack-plugin\lib\typescript-reporter\reporter\TypeScriptReporter.js:227:28)

I am not even sure where to start in looking to fix this

Not sure how much we can help with just that error message.

Are you making API requests? If you didn’t touch the frontend maybe it’s the backend that for some reason now isn’t returning valid JSON.

I was using this to get my passengers and flights which both were mapped to a table

`componentDidMount() {
    APIService.getFlights()
      .then((response) => {
        this.setState({
          flights: response.data
        });
      })
      .catch((err: Error) => {
        console.log(err);
      });

      APIService.getPassengers()
      .then((response) => {
        this.setState({
          passengers: response.data
        });
      })
      .catch((err: Error) => {
        console.log(err);
      });
  }
  `

did not have any issues there. The only thing I can think of is when trying to get my edit flight modal working, maybe it inserted something it doesnt like in the backend

Did you try logging the data in the APIService before returning it?

If it is happening on startup you should be able to narrow it down to just the calls made on mount.

Sorry was busy today and did not get a chance to respond earlier. I fixed the issue, just deleted my node modules folder and then ran npm install again

Well, that seems a bit odd. Sounds more like a coincidence to me but hey you never know (I just don’t see how anything can have changed with the packages if you didn’t touch the code)

I dont understand it myself. It was just “lets see if this does anything” kind of things. At first, it didnt seem like it would work. It did take a while for react to start up, but eventually it loaded up.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.