Home > Software design >  github workflow build and deploy to staging error
github workflow build and deploy to staging error

Time:03-02

i work on a project and want to make a github workflow , so it can deplay to staging automatically.

this is the workflow code :

name: Build and Deploy to GKE Staging
on:
  push:
    branches:
      - develop
env:
  PROJECT_ID: ...
  BUCKET: admin-dashboard-v2-stg
  VUE_APP_API_URL: ...
  VUE_APP_BASIC_AUTH: ...
jobs:
  setup-build:
    name: Setup and Build Application
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: "14"
      - uses: actions/cache@v2
        with:
          path: ~/.npm
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-node-
      - run: |-
          npm install
          npm run build
      - uses: actions/upload-artifact@v2
        with:
          name: dist
          path: dist/
  deploy:
    name: Deploy to GCS
    needs: setup-build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/download-artifact@v2
        with:
          name: dist
          path: dist
      - id: auth
        uses: google-github-actions/auth@v0
        with:
          credentials_json: ${{ secrets.GKE_PROJECT_SA }}
          project_id: ${PROJECT_ID}
      - name: Set up Cloud SDK
        uses: google-github-actions/[email protected]
      - name: Deploy
        run: |-
          ls -alh
          gsutil -m -h "Cache-Control:no-cache,max-age=0" rsync -d -r dist gs://${BUCKET}
      - uses: actions/upload-artifact@v2
        with:
          path: dist/

but it has error like this, the npm install and build command is work fine in my local devices, but in github workflow always make this error.

`2022-01-28T04:52:49.8662308Z ##[group]Run npm install
2022-01-28T04:52:49.8662713Z npm install
2022-01-28T04:52:49.8662957Z npm run build
2022-01-28T04:52:49.8715092Z shell: /usr/bin/bash -e {0}
2022-01-28T04:52:49.8715479Z env:
2022-01-28T04:52:49.8715720Z   PROJECT_ID: ...
2022-01-28T04:52:49.8716052Z   BUCKET: admin-dashboard-v2-stg
2022-01-28T04:52:49.8716397Z   VUE_APP_API_URL: ...
2022-01-28T04:52:49.8716765Z   VUE_APP_BASIC_AUTH: ...
2022-01-28T04:52:49.8717088Z ##[endgroup]
2022-01-28T04:52:50.6137707Z npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
2022-01-28T04:53:35.3740143Z 
2022-01-28T04:53:35.3742046Z > [email protected] install /home/runner/work/dashboard-v2/dashboard-v2/node_modules/yorkie
2022-01-28T04:53:35.3742700Z > node bin/install.js
2022-01-28T04:53:35.3743139Z 
2022-01-28T04:53:35.4369720Z CI detected, skipping Git hooks installation
2022-01-28T04:53:35.5499444Z 
2022-01-28T04:53:35.5501149Z > [email protected] postinstall /home/runner/work/dashboard-v2/dashboard-v2/node_modules/@nuxt/babel-preset-app/node_modules/core-js
2022-01-28T04:53:35.5501962Z > node -e "try{require('./postinstall')}catch(e){}"
2022-01-28T04:53:35.5619924Z 
2022-01-28T04:53:35.6723085Z 
2022-01-28T04:53:35.6725409Z > [email protected] postinstall /home/runner/work/dashboard-v2/dashboard-v2/node_modules/@vueuse/shared/node_modules/vue-demi
2022-01-28T04:53:35.6726036Z > node ./scripts/postinstall.js
2022-01-28T04:53:35.6726458Z 
2022-01-28T04:53:35.8022249Z 
2022-01-28T04:53:35.8023834Z > [email protected] postinstall /home/runner/work/dashboard-v2/dashboard-v2/node_modules/core-js
2022-01-28T04:53:35.8024638Z > node -e "try{require('./postinstall')}catch(e){}"
2022-01-28T04:53:35.8025105Z 
2022-01-28T04:53:35.8846789Z 
2022-01-28T04:53:35.8848585Z > [email protected] postinstall /home/runner/work/dashboard-v2/dashboard-v2/node_modules/ejs
2022-01-28T04:53:35.8849094Z > node ./postinstall.js
2022-01-28T04:53:35.8849374Z 
2022-01-28T04:53:35.9931333Z 
2022-01-28T04:53:35.9932663Z > [email protected] postinstall /home/runner/work/dashboard-v2/dashboard-v2/node_modules/highlight.js
2022-01-28T04:53:35.9933294Z > node deprecated.js
2022-01-28T04:53:35.9933510Z 
2022-01-28T04:53:36.0478540Z -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2022-01-28T04:53:36.0478943Z 
2022-01-28T04:53:36.0479269Z   Verion 9 of Highlight.js has reached EOL.  It will no longer
2022-01-28T04:53:36.0479635Z   be supported or receive security updates in the future.
2022-01-28T04:53:36.0479971Z   Please upgrade to version 10 or encourage your indirect
2022-01-28T04:53:36.0480241Z   dependencies to do so.
2022-01-28T04:53:36.0480381Z 
2022-01-28T04:53:36.0480544Z   For more info:
2022-01-28T04:53:36.0480771Z   
2022-01-28T04:53:36.0481246Z   https://github.com/highlightjs/highlight.js/issues/2877
2022-01-28T04:53:36.0481643Z   https://github.com/highlightjs/highlight.js/blob/master/VERSION_10_UPGRADE.md
2022-01-28T04:53:36.0481985Z  
2022-01-28T04:53:36.0482403Z -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2022-01-28T04:53:36.3802685Z 
2022-01-28T04:53:36.3804289Z > [email protected] postinstall /home/runner/work/dashboard-v2/dashboard-v2/node_modules/vue-demi
2022-01-28T04:53:36.3805357Z > node ./scripts/postinstall.js
2022-01-28T04:53:36.3805620Z 
2022-01-28T04:53:36.5624368Z 
2022-01-28T04:53:36.5625899Z > [email protected] postinstall /home/runner/work/dashboard-v2/dashboard-v2/node_modules/bootstrap-vue
2022-01-28T04:53:36.5626383Z > opencollective || exit 0
2022-01-28T04:53:36.5626616Z 
2022-01-28T04:53:36.6621310Z 
2022-01-28T04:53:36.6622680Z > [email protected] postinstall /home/runner/work/dashboard-v2/dashboard-v2/node_modules/nuxt
2022-01-28T04:53:36.6623195Z > opencollective || exit 0
2022-01-28T04:53:36.6623530Z 
2022-01-28T04:53:36.7622312Z 
2022-01-28T04:53:36.7623828Z > [email protected] postinstall /home/runner/work/dashboard-v2/dashboard-v2/node_modules/swiper
2022-01-28T04:53:36.7625182Z > echo "Love Swiper? Support Vladimir's work by donating or pledging on patreon:
2022-01-28T04:53:36.7625905Z  > https://patreon.com/vladimirkharlampidi
2022-01-28T04:53:36.7626518Z "
2022-01-28T04:53:36.7645885Z 
2022-01-28T04:53:36.7816830Z Love Swiper? Support Vladimir's work by donating or pledging on patreon:
2022-01-28T04:53:36.7817805Z  > https://patreon.com/vladimirkharlampidi
2022-01-28T04:53:36.7818291Z 
2022-01-28T04:53:38.1173242Z npm WARN The package vue-template-compiler is included as both a dev and production dependency.
2022-01-28T04:53:38.1269001Z npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/webpack-dev-server/node_modules/fsevents):
2022-01-28T04:53:38.1270428Z npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2022-01-28T04:53:38.1355114Z npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/watchpack-chokidar2/node_modules/fsevents):
2022-01-28T04:53:38.1356146Z npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2022-01-28T04:53:38.1459103Z npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
2022-01-28T04:53:38.1460073Z npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2022-01-28T04:53:38.1462344Z 
2022-01-28T04:53:38.1542777Z added 2001 packages from 1226 contributors and audited 2014 packages in 47.603s
2022-01-28T04:53:39.1518418Z 
2022-01-28T04:53:39.1519521Z 137 packages are looking for funding
2022-01-28T04:53:39.1520291Z   run `npm fund` for details
2022-01-28T04:53:39.1520501Z 
2022-01-28T04:53:39.1561301Z found 50 vulnerabilities (2 low, 26 moderate, 21 high, 1 critical)
2022-01-28T04:53:39.1561967Z   run `npm audit fix` to fix them, or `npm audit` for details
2022-01-28T04:53:39.3835345Z 
2022-01-28T04:53:39.3836498Z > [email protected] build /home/runner/work/dashboard-v2/dashboard-v2
2022-01-28T04:53:39.3836839Z > nuxt build; nuxt generate
2022-01-28T04:53:39.3836994Z 
2022-01-28T04:54:12.1634286Z [fatal] Nuxt build error
2022-01-28T04:54:12.1636320Z   ERROR in ./pages/Artisan/detail/profile.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--3-0!./node_modules/@nuxt/components/dist/loader.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/unplugin/dist/webpack/loaders/transform.js??ref--13-0!./pages/Artisan/detail/profile.vue?vue&type=script&lang=js&)
2022-01-28T04:54:12.1637504Z   Module not found: Error: Can't resolve '../../../dist/@core/components/feather-icon/FeatherIcon.vue' in 'pages/Artisan/detail'
2022-01-28T04:54:12.1688705Z   @ ./pages/Artisan/detail/profile.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--3-0!./node_modules/@nuxt/components/dist/loader.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/unplugin/dist/webpack/loaders/transform.js??ref--13-0!./pages/Artisan/detail/profile.vue?vue&type=script&lang=js&) 83:0-86 97:17-28
2022-01-28T04:54:12.1690121Z   @ ./pages/Artisan/detail/profile.vue?vue&type=script&lang=js&
2022-01-28T04:54:12.1697338Z   @ ./pages/Artisan/detail/profile.vue
2022-01-28T04:54:12.1697594Z   @ ./.nuxt/router.js
2022-01-28T04:54:12.1697786Z   @ ./.nuxt/index.js
2022-01-28T04:54:12.1697996Z   @ ./.nuxt/client.js
2022-01-28T04:54:12.1698619Z   @ multi ./node_modules/@nuxt/components/lib/installComponents.js ./.nuxt/composition-api/register.js ./.nuxt/client.js
2022-01-28T04:54:12.1698947Z   
2022-01-28T04:54:12.1700045Z   ERROR in ./pages/Artisan/detail/index.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--3-0!./node_modules/@nuxt/components/dist/loader.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/unplugin/dist/webpack/loaders/transform.js??ref--13-0!./pages/Artisan/detail/index.vue?vue&type=script&lang=js&)
2022-01-28T04:54:12.1701207Z   Module not found: Error: Can't resolve '../../../dist/@core/components/feather-icon/FeatherIcon.vue' in 'pages/Artisan/detail'
2022-01-28T04:54:12.1702487Z   @ ./pages/Artisan/detail/index.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--3-0!./node_modules/@nuxt/components/dist/loader.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/unplugin/dist/webpack/loaders/transform.js??ref--13-0!./pages/Artisan/detail/index.vue?vue&type=script&lang=js&) 135:0-86 155:17-28
2022-01-28T04:54:12.1703172Z   @ ./pages/Artisan/detail/index.vue?vue&type=script&lang=js&
2022-01-28T04:54:12.1703457Z   @ ./pages/Artisan/detail/index.vue
2022-01-28T04:54:12.1703683Z   @ ./.nuxt/router.js
2022-01-28T04:54:12.1703886Z   @ ./.nuxt/index.js
2022-01-28T04:54:12.1704105Z   @ ./.nuxt/client.js
2022-01-28T04:54:12.1704650Z   @ multi ./node_modules/@nuxt/components/lib/installComponents.js ./.nuxt/composition-api/register.js ./.nuxt/client.js
2022-01-28T04:54:12.1704957Z   
2022-01-28T04:54:12.1706008Z   ERROR in ./pages/Artisan/index.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--3-0!./node_modules/@nuxt/components/dist/loader.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/unplugin/dist/webpack/loaders/transform.js??ref--13-0!./pages/Artisan/index.vue?vue&type=script&lang=js&)
2022-01-28T04:54:12.1706897Z   Module not found: Error: Can't resolve '../../dist/@core/components/feather-icon/FeatherIcon.vue' in 'pages/Artisan'
2022-01-28T04:54:12.1708087Z   @ ./pages/Artisan/index.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--3-0!./node_modules/@nuxt/components/dist/loader.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/unplugin/dist/webpack/loaders/transform.js??ref--13-0!./pages/Artisan/index.vue?vue&type=script&lang=js&) 315:0-83 335:17-28
2022-01-28T04:54:12.1708743Z   @ ./pages/Artisan/index.vue?vue&type=script&lang=js&
2022-01-28T04:54:12.1709001Z   @ ./pages/Artisan/index.vue
2022-01-28T04:54:12.1709206Z   @ ./.nuxt/router.js
2022-01-28T04:54:12.1709406Z   @ ./.nuxt/index.js
2022-01-28T04:54:12.1709604Z   @ ./.nuxt/client.js
2022-01-28T04:54:12.1710131Z   @ multi ./node_modules/@nuxt/components/lib/installComponents.js ./.nuxt/composition-api/register.js ./.nuxt/client.js
2022-01-28T04:54:12.1710390Z 
2022-01-28T04:54:12.1712161Z    ╭─────────────────────────────╮
2022-01-28T04:54:12.1712506Z    │                             │
2022-01-28T04:54:12.1712799Z    │   ✖ Nuxt Fatal Error        │
2022-01-28T04:54:12.1713072Z    │                             │
2022-01-28T04:54:12.1713363Z    │   Error: Nuxt build error   │
2022-01-28T04:54:12.1713649Z    │                             │
2022-01-28T04:54:12.1713946Z    ╰─────────────────────────────╯
2022-01-28T04:54:12.1714081Z 
2022-01-28T04:54:44.3555413Z [fatal] Nuxt build error
2022-01-28T04:54:44.3557829Z   ERROR in ./pages/Artisan/detail/profile.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--3-0!./node_modules/@nuxt/components/dist/loader.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/unplugin/dist/webpack/loaders/transform.js??ref--13-0!./pages/Artisan/detail/profile.vue?vue&type=script&lang=js&)
2022-01-28T04:54:44.3559459Z   Module not found: Error: Can't resolve '../../../dist/@core/components/feather-icon/FeatherIcon.vue' in 'pages/Artisan/detail'
2022-01-28T04:54:44.3561333Z   @ ./pages/Artisan/detail/profile.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--3-0!./node_modules/@nuxt/components/dist/loader.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/unplugin/dist/webpack/loaders/transform.js??ref--13-0!./pages/Artisan/detail/profile.vue?vue&type=script&lang=js&) 83:0-86 97:17-28
2022-01-28T04:54:44.3610665Z   @ ./pages/Artisan/detail/profile.vue?vue&type=script&lang=js&
2022-01-28T04:54:44.3619091Z   @ ./pages/Artisan/detail/profile.vue
2022-01-28T04:54:44.3619375Z   @ ./node_modules/.cache/nuxt/router.js
2022-01-28T04:54:44.3619635Z   @ ./node_modules/.cache/nuxt/index.js
2022-01-28T04:54:44.3619906Z   @ ./node_modules/.cache/nuxt/client.js
2022-01-28T04:54:44.3620677Z   @ multi ./node_modules/@nuxt/components/lib/installComponents.js ./node_modules/.cache/nuxt/composition-api/register.js ./node_modules/.cache/nuxt/client.js
2022-01-28T04:54:44.3621029Z   
2022-01-28T04:54:44.3622127Z   ERROR in ./pages/Artisan/detail/index.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--3-0!./node_modules/@nuxt/components/dist/loader.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/unplugin/dist/webpack/loaders/transform.js??ref--13-0!./pages/Artisan/detail/index.vue?vue&type=script&lang=js&)
2022-01-28T04:54:44.3623071Z   Module not found: Error: Can't resolve '../../../dist/@core/components/feather-icon/FeatherIcon.vue' in 'pages/Artisan/detail'
2022-01-28T04:54:44.3624318Z   @ ./pages/Artisan/detail/index.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--3-0!./node_modules/@nuxt/components/dist/loader.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/unplugin/dist/webpack/loaders/transform.js??ref--13-0!./pages/Artisan/detail/index.vue?vue&type=script&lang=js&) 135:0-86 155:17-28
2022-01-28T04:54:44.3625014Z   @ ./pages/Artisan/detail/index.vue?vue&type=script&lang=js&
2022-01-28T04:54:44.3625314Z   @ ./pages/Artisan/detail/index.vue
2022-01-28T04:54:44.3625573Z   @ ./node_modules/.cache/nuxt/router.js
2022-01-28T04:54:44.3625844Z   @ ./node_modules/.cache/nuxt/index.js
2022-01-28T04:54:44.3626100Z   @ ./node_modules/.cache/nuxt/client.js
2022-01-28T04:54:44.3626759Z   @ multi ./node_modules/@nuxt/components/lib/installComponents.js ./node_modules/.cache/nuxt/composition-api/register.js ./node_modules/.cache/nuxt/client.js
2022-01-28T04:54:44.3627115Z   
2022-01-28T04:54:44.3628143Z   ERROR in ./pages/Artisan/index.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--3-0!./node_modules/@nuxt/components/dist/loader.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/unplugin/dist/webpack/loaders/transform.js??ref--13-0!./pages/Artisan/index.vue?vue&type=script&lang=js&)
2022-01-28T04:54:44.3629051Z   Module not found: Error: Can't resolve '../../dist/@core/components/feather-icon/FeatherIcon.vue' in 'pages/Artisan'
2022-01-28T04:54:44.3643162Z   @ ./pages/Artisan/index.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--3-0!./node_modules/@nuxt/components/dist/loader.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/unplugin/dist/webpack/loaders/transform.js??ref--13-0!./pages/Artisan/index.vue?vue&type=script&lang=js&) 315:0-83 335:17-28
2022-01-28T04:54:44.3643873Z   @ ./pages/Artisan/index.vue?vue&type=script&lang=js&
2022-01-28T04:54:44.3644126Z   @ ./pages/Artisan/index.vue
2022-01-28T04:54:44.3644394Z   @ ./node_modules/.cache/nuxt/router.js
2022-01-28T04:54:44.3644662Z   @ ./node_modules/.cache/nuxt/index.js
2022-01-28T04:54:44.3644935Z   @ ./node_modules/.cache/nuxt/client.js
2022-01-28T04:54:44.3645588Z   @ multi ./node_modules/@nuxt/components/lib/installComponents.js ./node_modules/.cache/nuxt/composition-api/register.js ./node_modules/.cache/nuxt/client.js
2022-01-28T04:54:44.3646094Z 
2022-01-28T04:54:44.3647604Z    ╭─────────────────────────────╮
2022-01-28T04:54:44.3647936Z    │                             │
2022-01-28T04:54:44.3648219Z    │   ✖ Nuxt Fatal Error        │
2022-01-28T04:54:44.3648508Z    │                             │
2022-01-28T04:54:44.3648785Z    │   Error: Nuxt build error   │
2022-01-28T04:54:44.3649068Z    │                             │
2022-01-28T04:54:44.3649361Z    ╰─────────────────────────────╯
2022-01-28T04:54:44.3649495Z 
2022-01-28T04:54:44.3925540Z npm ERR! code ELIFECYCLE
2022-01-28T04:54:44.3926554Z npm ERR! errno 1
2022-01-28T04:54:44.3957098Z npm ERR! [email protected] build: `nuxt build; nuxt generate`
2022-01-28T04:54:44.3957918Z npm ERR! Exit status 1
2022-01-28T04:54:44.3958523Z npm ERR! 
2022-01-28T04:54:44.3958935Z npm ERR! Failed at the [email protected] build script.
2022-01-28T04:54:44.3962098Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2022-01-28T04:54:44.4026834Z 
2022-01-28T04:54:44.4031290Z npm ERR! A complete log of this run can be found in:
2022-01-28T04:54:44.4032602Z npm ERR!     /home/runner/.npm/_logs/2022-01-28T04_54_44_396Z-debug.log
2022-01-28T04:54:44.4094413Z ##[error]Process completed with exit code 1.

did you see is there anything wrong with ?

CodePudding user response:

Module not found: Error: Can't resolve '../../../dist/@core/components/feather-icon/FeatherIcon.vue' in 'pages/Artisan/detail'

Here, in your code, you're importing an icon from the dist folder. You're probably ignoring that folder when you push to Github. That's why it can't find it. You should import directly from the Feather Icons library.

  • Related