我已经将我的 NextJS 项目(改编自https://github.com/zeit/next.js/tree/master/examples/with-firebase-hosting)部署到 firebase,但是当我浏览到 URL 时,我得到“内部服务器错误”。
部署确实成功运行:
i deploying database, functions, hosting
+ database: rules ready to deploy.
i functions: ensuring necessary APIs are enabled...
i runtimeconfig: ensuring necessary APIs are enabled...
+ runtimeconfig: all necessary APIs are enabled
+ functions: all necessary APIs are enabled
i functions: preparing src/functions directory for uploading...
i functions: packaged src/functions (571.83 KB) for uploading
+ functions: src/functions folder uploaded successfully
i hosting: preparing src/public directory for upload...
! Warning: Public directory does not contain index.html
i Progress: [....................................................................................................]
+ hosting: 3 files uploaded successfully
i starting release process (may take several minutes)...
i functions: updating function next...
+ functions[next]: Successful update operation.
+ functions: all functions deployed successfully!
+ Deploy complete!
所以我觉得这可能与我的项目结构有关?还是 firebase.json 配置?有人可以看看让我知道吗?
这是我的项目根目录中的 firebase.json:
{
"database": {
"rules": "database.rules.json"
},
"functions": {
"source": "src/functions"
},
"hosting": {
"public": "src/public",
"rewrites": [
{
"source": "**/**",
"function": "next"
}
],
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}