简体   繁体   English

Nuxt 致命错误在 GitHub 操作中启动 nuxt

[英]Nuxt Fatal Error starting nuxt in GitHub Actions

I'm running a GitHub actions workflow that builds and runs a nuxt app for cypress.js testing.我正在运行一个 GitHub 动作工作流,该工作流构建并运行一个用于 cypress.js 测试的 nuxt 应用程序。 I'm receiving a Nuxt Fatal error that I can't seem to figure out from reading the stack when building the app.我收到了一个 Nuxt 致命错误,在构建应用程序时我似乎无法通过读取堆栈来弄清楚。

FYI, I have looked through EVERY error logged in StackOverflow with this Fatal error but can't seem to find a solution.仅供参考,我已经查看了 StackOverflow 中记录的每一个错误,但似乎无法找到解决方案。

Here's my GitHub Actions workflow (everything seems to run OK):这是我的 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 }}

And here is the error.这是错误。 I do not understand why there is an error referring to an unresolved path.我不明白为什么会出现引用未解析路径的错误。 The path is actually correct.路径实际上是正确的。 This also runs locally, in a dev server, staging server, and production without any problem:这也可以在开发服务器、登台服务器和生产环境中本地运行,没有任何问题:


[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.

Figured it out.弄清楚了。

The component was calling "DottedNoteBook" but the file name is "DottedNotebook.vue".该组件正在调用“DottedNoteBook”,但文件名为“DottedNotebook.vue”。 (Different case for the letter "B".) (字母“B”的不同大小写。)

I'm not sure why that case issue never came up before or preventing compiling outside of the GitHub Actions, but that was the issue.我不确定为什么以前从未出现过该案例问题或阻止在 GitHub 操作之外进行编译,但这就是问题所在。 Thanks, @Tarkan for making me look closer at that.谢谢,@Tarkan 让我仔细看看。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM