Home
Support Forums

Help! Problem with deploying my nextjs app

PLEASE help me!
I get this error:


8:07:03 AM: npm ERR! code EJSONPARSE

8:07:03 AM: npm ERR! path /opt/build/repo/package.json

8:07:03 AM: npm ERR! JSON.parse Unexpected token “}” (0x7D) in JSON at position 165 while parsing near “…nt”: “next lint”,\n },\n “dependencies”:…"

8:07:03 AM: npm ERR! JSON.parse Failed to parse JSON data.

8:07:05 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1

8:07:03 AM: npm ERR! JSON.parse Note: package.json must be actual JSON, not just JavaScript.

8:07:03 AM: npm ERR! A complete log of this run can be found in:

8:07:03 AM: npm ERR! /opt/buildhome/.npm/_logs/2021-11-03T04_37_03_836Z-debug.log

8:07:03 AM: Error during NPM install

8:07:03 AM: Build was terminated: Build script returned non-zero exit code: 1

8:07:05 AM: Failing build: Failed to build site

I need your help that how resolve this problem.

Hi @mmsafari

Line 8 of the package.json in your repository contains a comma at the end meaning it is invalid.

"lint": "next lint",

Removing the comma will solve this issue. Assuming there are no other issues, your build should succeed.

hi , thanks for your attention, I deleted what you said, but the problem and error still remain

8:44:16 AM: Installing NPM modules using NPM version 8.1.0

8:44:17 AM: npm ERR! code EJSONPARSE

8:44:17 AM: npm ERR! path /opt/build/repo/package.json

8:44:17 AM: npm ERR! JSON.parse Unexpected token “}” (0x7D) in JSON at position 140 while parsing near “…t”: “next start”,\n },\n “dependencies”:…"

8:44:17 AM: npm ERR! JSON.parse Failed to parse JSON data.

8:44:17 AM: npm ERR! JSON.parse Note: package.json must be actual JSON, not just JavaScript.

8:44:17 AM: npm ERR! A complete log of this run can be found in:

8:44:17 AM: npm ERR! /opt/buildhome/.npm/_logs/2021-11-03T05_14_17_109Z-debug.log

8:44:17 AM: Error during NPM install

8:44:17 AM: Build was terminated: Build script returned non-zero exit code: 1

8:44:17 AM: Creating deploy upload records

8:44:17 AM: Failing build: Failed to build site

8:44:17 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1

8:44:17 AM: Finished processing build request in 12.467417674s

Capture2

Is there anything I need to change?

Captured

I didn’t mean to remove the entire line, simply the comma (,) at the end of the line.

You now have the same issue with the start script line which ends in a comma

"start": "next start",

It needs to look like this

"start": "next start"

Thanks a lot,
My problem is solved