- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们目前在新的 Nuxt3 静态 Web 应用程序的 GitHub Actions 中遇到 NewtonSoft.Json 构建问题。应用程序在本地完美构建和运行(npm run dev),但在尝试通过 GitHub 操作部署到 Azure 时,构建/部署过程失败。构建期间抛出的异常和 GitHub actions 工作流程 yaml 文件如下所示:
`**`Build Operation ID: 75d5ecf1017c042b
OS Type : bullseye
Image Type : jamstack
Detecting platforms...
Error: Oops... An unexpected error has occurred.
Error: Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1.
at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JObject.Parse(String json)
at Microsoft.Oryx.Detector.ParserHelper.ParseJsonFile(ISourceRepo sourceRepo, String filePath) in /usr/oryx/src/Detector/ParserHelper.cs:line 86
at Microsoft.Oryx.Detector.Hugo.HugoDetector.IsHugoJsonFile(ISourceRepo sourceRepo, String\[\] subPaths) in /usr/oryx/src/Detector/Hugo/HugoDetector.cs:line 218
at Microsoft.Oryx.Detector.Hugo.HugoDetector.IsHugoApp(ISourceRepo sourceRepo, String& appDirectory) in /usr/oryx/src/Detector/Hugo/HugoDetector.cs:line 145
at Microsoft.Oryx.Detector.Hugo.HugoDetector.Detect(DetectorContext context) in /usr/oryx/src/Detector/Hugo/HugoDetector.cs:line 49
at Microsoft.Oryx.BuildScriptGenerator.Hugo.HugoPlatform.Detect(RepositoryContext context) in /usr/oryx/src/BuildScriptGenerator/Hugo/HugoPlatform.cs:line 61
at Microsoft.Oryx.BuildScriptGenerator.DefaultPlatformsInformationProvider.GetPlatformsInfo(RepositoryContext context) in /usr/oryx/src/BuildScriptGenerator/DefaultPlatformsInformationProvider.cs:line 53
at Microsoft.Oryx.BuildScriptGenerator.DefaultBuildScriptGenerator.GenerateBashScript(BuildScriptGeneratorContext context, String& script, List\`1 checkerMessageSink) in /usr/oryx/src/BuildScriptGenerator/DefaultBuildScriptGenerator.cs:line 75
at Microsoft.Oryx.BuildScriptGeneratorCli.BuildScriptGenerator.TryGenerateScript(String& generatedScript, Exception& exception) in /usr/oryx/src/BuildScriptGeneratorCli/BuildScriptGenerator.cs:line 63
at Microsoft.Oryx.BuildScriptGeneratorCli.BuildCommand.Execute(IServiceProvider serviceProvider, IConsole console) in /usr/oryx/src/BuildScriptGeneratorCli/Commands/BuildCommand.cs:line 278
at Microsoft.Oryx.BuildScriptGeneratorCli.CommandBase.OnExecute(IConsole console) in /usr/oryx/src/BuildScriptGeneratorCli/Commands/CommandBase.cs:line 87`**`
name: Azure Static Web Apps CI/CD
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ASHY_MUSHROOM_036506E0F }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/" # App source code path
api_location: ".output/server" # Api source code path - optional
output_location: ".output/public" # Built app content directory - optional
###### End of Repository/Build Configurations ######
close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ASHY_MUSHROOM_036506E0F }}
action: "close"
作为故障排除的一部分,我还使用 nuxi 搭建了一个准系统 Nuxt3 静态 Web 应用程序,并配置了一个新的 Azure 静态 Web 应用程序,并且部署的应用程序没有出现问题。然而,一旦我集成了有问题的应用程序中的代码,我再次开始收到上述异常。有问题的应用程序也按原样部署到 Vercel,没有出现任何问题,因此这似乎是 Azure 特定的部署问题。归根结底,我不太确定为什么我们会在 Nuxt3/node 应用程序上遇到 Newtonsoft.Json.JsonReaderException,因为这是我希望在运行时在 .net 应用程序上看到的情况。
最佳答案
我尝试部署示例 Nuxt app 通过 github actions 部署成功,引用如下:-
Nuxt 应用程序在本地成功运行,如下所示:-
创建一个静态 Web 应用程序并从 github 存储库部署 Nuxt 应用程序,如下所示:-
Nuxt 应用程序已成功部署在 Azure 静态 Web 应用程序中,如下所示:-
我的 github 工作流程脚本:-
name: Azure Static Web Apps CI/CD
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_THANKFUL_GROUND_085802C10 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/" # App source code path
api_location: ".output/server" # Api source code path - optional
output_location: ".output/public" # Built app content directory - optional
###### End of Repository/Build Configurations ######
close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_THANKFUL_GROUND_085802C10 }}
action: "close"
我的 github 存储库:-
我的package.json:-
{
"name": "nuxt-3-starter",
"version": "1.0.0",
"description": "My Nuxt 3 Test",
"author": "Nuzhat Minhaz",
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview"
},
"devDependencies": {
"nuxt": "3.0.0-rc.6"
}
}
您似乎在 Azure 平台级别遇到问题,请单击“诊断并解决问题”,然后单击“内容部署”以深入了解静态 Web 应用程序部署:-
您还可以启用 Application Insights 并检查 Application Insights 中的日志,如下所示以分析您的错误:-
关于node.js - Nuxt 3 应用程序 GitHub Actions Build 中的 NewtonSoft.Json 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76640058/
我从这里复制了一些文件:https://codesandbox.io/s/github/nuxt/nuxt.js/tree/dev/examples/custom-loading?from-embed
我已经在整个互联网上搜索了我的问题的答案。到目前为止没有运气。 我想要达到的目标: 我有一个在通用模式下运行的 Nuxt 应用程序。它类似于一个小型社交网络,用户可以在其中创建自己的个人资料并分享他们
在我的 nuxt 应用程序中,嵌套目录中的组件不会按预期自动导入。对于我的一些组件,我有如下内容:vue 2.6.12 , nuxt 2.15.0components\目录结构 TopArea\ --
我有点困惑,因为在官方 nuxt 网站上它说当前的 nuxt 版本是 2.5.X 但是当我使用 npx create-nuxt-app 创建 nuxt 应用程序时并检查 package.json在依赖
我有survey-vue(surveyJS)在dev上运行良好,但是当我尝试部署时,登陆带有调查组件的页面时出现最大调用堆栈大小超出错误。 我在想这就是我导入插件的方式,但我不确定。 插件/surve
我有如下路径 路径:'/board/:type(\d{2}):subtype(\d{2}):id(\d+)' 所以这是这样的 http://localhost:3000/board/112233333
我构建多应用 Nuxt 项目,这些应用之间不直接通信。每个应用程序都有自己的商店,我想为共享商店使用一个目录。我将这种方法用于组件并且效果很好。 |-> app1 | |-> store // s
将我的 nuxt-cli 版本升级到 2.15.3 后,我注意到页面 block 的大小减小了,所有 node_modules 安装的包现在都被捆绑到现在变得越来越大的 app.js 中。 在下面你可
我正在使用 nuxt 生成完整的静态 Web 应用程序,如下所述 https://nuxtjs.org/blog/going-full-static/#crazy-fast-static-applic
我已经看到很多与此主题相关的问题。但是他们都没有解决我的问题。 我有一个情况,我必须检查 innerWidth窗口,使用 isMobile 检查设备是否可移动多变的。 ...
我在最新版本的 Vuetify 中使用 NuxtJs。 在我的导航栏中有一个通向主页的主页按钮,这是它的代码: mdi-home 只要我在主页上,图标就会悬停: 一旦
我有一个登录页面,我希望登录的用户无法看到。我的组件如下: ... ... @Component({ layout: 'fullWidth', auth: '
我正在创建一个插件,它将发出由套接字触发的基本 nuxt 事件。然后将收到 nuxt 事件并打开一个 snackbar 。在组件内部时,使用 $nuxt 可以轻松发送和接收事件。 this.$nuxt
我有一个Composable,它返回一个函数,在5秒的间隔内验证身份验证和刷新令牌。两者都利用Nuxt的useCookie实用程序函数来执行其背后的逻辑。。起初,它是有效的。但有时,当令牌到期时,它会
我不能在这里使用 window.location,因为它是 SSR 应用程序。useRouter、useRoute 和 useNuxtApp 也没有域名。nuxtApp.ssrContext 未定义。
我在 nuxt.js 上有前端服务器,在带有 django-rest-framework 的 django 中有后端。谁能给我一个使用 nuxt-auth 本地策略刷新 jwt token 的例子?我
有很多关于 Nuxt SSR 或全静态的信息,但我找不到任何指南如何构建具有静态页面的混合 SSR。 我正在使用 Nuxt SSR 构建一个网站,我想从一个 10MB 的 JSON 文件静态预渲染所有
我在本地构建了nuxt js的项目,即npm run build,然后将项目推送到.nuxt文件夹,而不是node_modules文件夹。然后运行npm run start命令,失败。 输出信息:sh
我有一个 NUXT 项目,我正在尝试添加 301 重定向。我尝试了几种不同的方法,但没有任何效果。如果我转到旧 URL,我会得到一个 404 页面。 向 Nuxt 项目添加重定向的最佳方式是什么? 任
我正在使用 Nuxt Content存储应用程序内容(JSON 文件)。它在热重载的开发模式下工作很酷。我网站的后端更改内容文件夹中的任何文件,并且这会立即在浏览器中更改而无需重新加载页面。但在生产模
我是一名优秀的程序员,十分优秀!