关键词:
【中文标题】在 GitHub Actions 中启动 nuxt 时出现 Nuxt 致命错误【英文标题】:Nuxt Fatal Error starting nuxt in GitHub Actions 【发布时间】:2021-10-19 01:26:11 【问题描述】:我正在运行一个 GitHub 操作工作流程,该工作流程构建并运行一个用于 cypress.js 测试的 nuxt 应用程序。我收到了一个 Nuxt 致命错误,在构建应用程序时,我似乎无法通过读取堆栈来发现该错误。
仅供参考,我已经查看了 *** 中记录的每个错误,并出现此致命错误,但似乎找不到解决方案。
这是我的 GitHub Actions 工作流程(一切似乎运行正常):
name: Cypress run on push
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [14.17.0]
containers: [1, 2, 3, 4, 5]
steps:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: $ matrix.node
- run: node -v
- name: Checkout
uses: actions/checkout@v2
- name: Running npm ci (installing dependencies)
run: npm ci
- name: Running npm install
run: npm install
# Update Browserlist
- run: npx browserslist@latest --update-db
- name: Starting test server and running Cypress
uses: cypress-io/github-action@v2
with:
build: npm run build
start: npm run start
wait-on: 'http://localhost:3000/'
wait-on-timeout: 120
record: true
parallel: true
# browser: chrome
# headless: true
env:
CYPRESS_RECORD_KEY: $ secrets.CYPRESS_RECORD_KEY
GITHUB_TOKEN: $ secrets.GITHUB_TOKEN
这是错误。我不明白为什么会出现引用未解决路径的错误。路径实际上是正确的。这也可以在本地、开发服务器、暂存服务器和生产中运行,没有任何问题:
[fatal] Nuxt build error
ERROR in ./components/ui/dialogs/SocialMediaWrapper.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./components/ui/dialogs/SocialMediaWrapper.vue?vue&type=script&lang=js&)
Module not found: Error: Can't resolve '@/components/svg/DottedNoteBook' in 'components/ui/dialogs'
@ ./components/ui/dialogs/SocialMediaWrapper.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./components/ui/dialogs/SocialMediaWrapper.vue?vue&type=script&lang=js&) 200:0-61 203:20-34
@ ./components/ui/dialogs/SocialMediaWrapper.vue?vue&type=script&lang=js&
@ ./components/ui/dialogs/SocialMediaWrapper.vue
@ ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/trial-view/_id.vue?vue&type=script&lang=js&
@ ./pages/trial-view/_id.vue?vue&type=script&lang=js&
@ ./pages/trial-view/_id.vue
@ ./.nuxt/router.js
@ ./.nuxt/index.js
@ ./.nuxt/client.js
@ multi ./.nuxt/client.js
╭─────────────────────────────╮
│ │
│ ✖ Nuxt Fatal Error │
│ │
│ Error: Nuxt build error │
│ │
╰─────────────────────────────╯
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! JurorSearch@2.18.6 build: `nuxt build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the JurorSearch@2.18.6 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-08-17T05_30_28_916Z-debug.log
Error: Process completed with exit code 1.
【问题讨论】:
在您发送的错误日志的第 3 行,它说它无法解析@/components/svg/DottedNoteBook
。如果您的 /components
文件夹中有一个常规的 .svg 文件,我会将其移动到 /assets
并在路径末尾使用 .svg
导入它。如果是组件,则尝试在路径末尾使用.vue
导入组件。
感谢@Tarkan - “svg” 是一个目录,“DopttedNotebook” 是一个 Vue 组件(实际上是“DottedNotebook.vue”),它包含多个用于渲染 svg 的函数。这不是一个 svg 文件。我将尝试将 .vue 添加到导入中,看看会发生什么。奇怪的是,除了 GitHub Actions 之外,其他任何地方都不会发生这种情况。
【参考方案1】:
想通了。
组件调用了“DottedNoteBook”,但文件名为“DottedNotebook.vue”。 (字母“B”的大小写不同。)
我不确定为什么以前从未出现过该案例问题或阻止在 GitHub Actions 之外进行编译,但这就是问题所在。谢谢@Tarkan 让我仔细看看。
【讨论】:
Jest + Nuxt + Nuxt-Fire 在测试套件中失败
...-05-2122:46:51【问题描述】:我正在使用Nuxt和Nuxt-Fire(https://github.com/lupas/nuxt-fire)当我启动测试时,我收到此错误[Vuewarn]:Errorinconfig.errorHandler:"Ty 查看详情
在 Github Actions 中克隆一个私有仓库
】在GithubActions中克隆一个私有仓库【英文标题】:CloningaprivaterepoinGithubActions【发布时间】:2020-06-1700:59:21【问题描述】:我正在尝试在Github操作中克隆另一个私人仓库。我在我正在运行操作的回购的秘密中设置了SECRET_USER和SECRE... 查看详情
在 Windows 上的 GitHub Actions 中缓存依赖项
】在Windows上的GitHubActions中缓存依赖项【英文标题】:CachedependenciesinGitHubActionsonWindows【发布时间】:2021-11-1821:09:16【问题描述】:我有一个在Windows操作系统上运行的Github操作。然后,为了缓存依赖项,我使用actions/cache@v2。但是... 查看详情
如何在 Github Actions 中获取当前分支?
】如何在GithubActions中获取当前分支?【英文标题】:HowtogetthecurrentbranchwithinGithubActions?【发布时间】:2020-01-2119:22:54【问题描述】:我正在使用GithubActions构建Docker映像,并希望使用分支名称标记映像。我找到了GITHUB_REF变量,但... 查看详情
如何在 GitHub Actions 中使用最新发布标签?
】如何在GitHubActions中使用最新发布标签?【英文标题】:HowtouselatestreleasetaginGitHubActions?【发布时间】:2021-12-1020:12:35【问题描述】:我想通过在GitHub中创建发布标签来控制发布,例如:name:deploy-liveon:push:tags:-release-v*但也可以运... 查看详情
如何在 GitHub Actions 中缓存纱线包
】如何在GitHubActions中缓存纱线包【英文标题】:HowtocacheyarnpackagesinGitHubActions【发布时间】:2020-07-1512:41:47【问题描述】:我正在使用GitHubActions构建我的TypeScript项目。每次我运行操作时,我都会等待3分钟以安装所有依赖项。有... 查看详情
在 GitHub Actions 中运行 Selenium Webdriver 以进行单元测试
】在GitHubActions中运行SeleniumWebdriver以进行单元测试【英文标题】:RunningSeleniumWebdriverinGitHubActionsforunittests【发布时间】:2022-01-1708:33:44【问题描述】:在部署我的AWSLambda之前,我尝试在GitHub操作中运行单元测试,我在其中运行Sel... 查看详情
在 GitHub Actions 中使用 docker 文件
】在GitHubActions中使用docker文件【英文标题】:UseofdockerfilesinGitHubActions【发布时间】:2022-01-2004:14:06【问题描述】:我想在GithubAction中使用pandoc从Markdown文件生成pdf。为此,我打算使用现有的Docker容器来提高性能。但不幸的是,... 查看详情
在 Github Actions 中使用 Powershell 的输出
】在GithubActions中使用Powershell的输出【英文标题】:UsingoutputsofPowershellinGithubActions【发布时间】:2021-11-0501:04:51【问题描述】:我正在尝试使用Powershell获取连接字符串并将此参数传递给操作中的另一个步骤,但我收到此错误:Inp... 查看详情
在 Github Actions 中获取 Maven 项目版本
】在GithubActions中获取Maven项目版本【英文标题】:GettingMavenProjectversionwithinGithubActions【发布时间】:2020-12-1805:22:28【问题描述】:我正在尝试获取我的maven项目的版本作为部署过程的一部分,但我似乎在命令的输出中遇到了错误... 查看详情
如何在 Github Actions 中获取 SECRETS 的值?
】如何在GithubActions中获取SECRETS的值?【英文标题】:HowtoaccessthevalueofSECRETSinGithubActions?【发布时间】:2019-06-2711:10:24【问题描述】:我正在尝试访问发送到GitHubAction的SECRETs的值,但我很挣扎。每次返回的值都是[FILTERED],不管key... 查看详情
如何在 GitHub Actions 中使用 env 文件?
】如何在GitHubActions中使用env文件?【英文标题】:HowdoIuseanenvfilewithGitHubActions?【发布时间】:2020-05-2706:50:32【问题描述】:我有多个环境(dev、qa、prod)并且我正在使用.env文件来存储机密等...现在我正在切换到GitHubActions,我想... 查看详情
如何在 GitHub Actions 中构建的 Dockerfile 中使用 github 令牌并尝试克隆私有存储库?
】如何在GitHubActions中构建的Dockerfile中使用github令牌并尝试克隆私有存储库?【英文标题】:HowtousegithubtokeninDockerfilethatisbuiltinGitHubActionsandtryingtocloneprivaterepository?【发布时间】:2021-09-1708:49:05【问题描述】:这是我的GitHub操作步... 查看详情
使用 GitHub Actions 在 ECS 中注册任务定义失败
】使用GitHubActions在ECS中注册任务定义失败【英文标题】:FailedtoregistertaskdefinitioninECSwithGitHubActions【发布时间】:2020-12-1917:46:27【问题描述】:我正在为AWSFargate设置一个GithubActionsCI。但是在DeployAmazonECS任务定义这一步面临权限问... 查看详情
如何在 Github Actions 工作流中从 Github 包访问 Maven 依赖项?
】如何在GithubActions工作流中从Github包访问Maven依赖项?【英文标题】:HowtoaccessMavendependencyfromGithubPackagesonaGithubActionsworkflow?【发布时间】:2021-02-1817:18:00【问题描述】:我的构建通过直接在pom.xml<repository>元素上使用用... 查看详情
在 GitHub Actions 中添加基于日期的标签
】在GitHubActions中添加基于日期的标签【英文标题】:Bumpdate-basedtaginGitHubActions【发布时间】:2022-01-1709:08:00【问题描述】:我正在尝试使用发布标签基于日期的GitHubActions创建project的自动发布。我不想使用标准语义版本控制,因... 查看详情
如何在 Github Actions 中运行多个 Node 应用程序?
】如何在GithubActions中运行多个Node应用程序?【英文标题】:HowcanIrunmultipleNodeAppinaGithubActions?【发布时间】:2021-07-1720:36:12【问题描述】:这是我的行为#ThisisabasicworkflowtohelpyougetstartedwithActionsname:CI/CDAkperBinaInsan-Liveon:push:branches:[ma... 查看详情
在 GitHub Actions 中缓存 node_modules
】在GitHubActions中缓存node_modules【英文标题】:Cachenode_modulesinGitHubActions【发布时间】:2021-07-1203:38:59【问题描述】:我有一个带有2个包的Yarnmonorepo(工作区):后端(Node.js/TypeScript)和前端(React/Typescript)。/package.json(修剪)... 查看详情