我想学习 Next Js 并关注 Youtube Video Next.js Crash Course - Server Side React by Traversy Media
我也关注了 Nextjs Offical Docs 的 setps
我刚刚把下面的代码放在 pages/index.js 文件中
export default function Home()
{
return <h1>Welcome to my Website</h1>
}
在 Package.json 我把下面的代码:
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
我在 cmd 下运行以运行下一个应用程序
npm run dev
当我打开 Chrome 浏览器时,我看到没有渲染,并且在控制台中出现以下错误。
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)
要启动下一个应用程序,我还需要做任何其他设置吗?
最佳答案
我建议这个 "scripts":...
应该放在预填充里面的特定位置Package.json
, 不替换整个文件
关于javascript - 下一个 js 在位置 0 处运行 dev 意外 token u JSON,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62479301/