javascript - 下一个 js 在位置 0 处运行 dev 意外令牌 u 在 JSON 中
问题描述
我想学习 Next Js 并关注了 Traversy Media 的 Youtube Video Next.js Crash Course - Server Side React
我还遵循了Nextjs 官方文档中的 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":...
应该放在 pre-filled 中的特定位置Package.json
,而不是替换整个文件
推荐阅读
- c# - 无法使用 c# 代码将视频上传到 youtube 频道 - 错误 400:redirect_uri_mismatch
- java - 在 Android 上通过 GSON 从嵌套 JSON 数组中获取价值?
- nginx - 几天后,Nginx 反向代理将请求定向到 .255 地址
- java - SQS 消息大小超过 256 kB
- acumatica - 在不同的实例中使用定制的 acumatica 报表设计器报表
- networking - TCP 校验和与wireshark 校验和不匹配(正好相差1)
- mysql - MySQL在两个日期和时间之间选择项目
- node.js - 如何从 HTTP 响应中保存音频(mp3)
- python - Python MySQL,获取特殊列名
- javascript - 将边框半径属性应用于浏览器窗口?