簡體   English   中英

Nuxt 致命錯誤在 GitHub 操作中啟動 nuxt

[英]Nuxt Fatal Error starting nuxt in GitHub Actions

我正在運行一個 GitHub 動作工作流,該工作流構建並運行一個用於 cypress.js 測試的 nuxt 應用程序。 我收到了一個 Nuxt 致命錯誤,在構建應用程序時我似乎無法通過讀取堆棧來弄清楚。

僅供參考,我已經查看了 StackOverflow 中記錄的每一個錯誤,但似乎無法找到解決方案。

這是我的 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.

弄清楚了。

該組件正在調用“DottedNoteBook”,但文件名為“DottedNotebook.vue”。 (字母“B”的不同大小寫。)

我不確定為什么以前從未出現過該案例問題或阻止在 GitHub 操作之外進行編譯,但這就是問題所在。 謝謝,@Tarkan 讓我仔細看看。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM