next js run dev Unexpected token u in JSON at position 0

Viewed 1732

I wanted to learn Next Js and followed Youtube Video Next.js Crash Course - Server Side React by Traversy Media

I also followed the setps from Nextjs Offical Docs

I have just put below code in pages/index.js file

export default function Home()
{
    return <h1>Welcome to my Website</h1>
}

In Package.json I have put below code :

"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},

I run below cmd to run the next app

npm run dev

When I open my Chrome Browser I see Nothing rendered and in console I am getting below error.

VM117:1 Uncaught SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse (<anonymous>) at eval (platform.js?2a2e:14) at Object../node_modules/ally.js/util/platform.js (main.js?ts=1592604315070:1786) at __webpack_require__ (webpack.js?ts=1592604315070:863) at fn (webpack.js?ts=1592604315070:151) at eval (detect-focus.js?93d2:19) at Object../node_modules/ally.js/supports/detect-focus.js (main.js?ts=1592604315070:1102) at __webpack_require__ (webpack.js?ts=1592604315070:863) at fn (webpack.js?ts=1592604315070:151) at eval (supports.js?750b:21)

Is there any other setting I need to do to start next app ?

1 Answers

I suggest this "scripts":... should be put to the particular place inside pre-filled Package.json, not replacing the whole file

Related