본문 바로가기
IT

firebase web hosting 배포 시 node.js 버전 해결 방법

by 내일은교양왕 2023. 12. 17.

github action을 통해 잘 되던 자동 배포가 갑자기 안되어서 확인해보니 아래와 같은 에러가 노출되었다.

확인해보니 firebase-tools가 노드 16버전을 지원을 안한다고 한다.

 

에러 내용

Deploying to production site
18 /opt/hostedtoolcache/node/16.20.2/x64/bin/npx firebase-tools@latest deploy --only hosting --project portfolio-1a12f --json
19 npm WARN exec The following package was not found and will be installed: firebase-tools@13.0.2
20 npm WARN EBADENGINE Unsupported engine ***
21 npm WARN EBADENGINE package: 'firebase-tools@13.0.2',
22 npm WARN EBADENGINE required: *** node: '>=18.0.0 || >=20.0.0' ***,
23 npm WARN EBADENGINE current: *** node: 'v16.20.2', npm: '8.19.4' ***
24 npm WARN EBADENGINE ***
25 Firebase CLI v13.0.2 is incompatible with Node.js v16.20.2 Please upgrade Node.js to version >=18.0.0 || >=20.0.0
27 The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npx' failed with exit code 1
28 Retrying deploy with the --debug flag for better error output
29 /opt/hostedtoolcache/node/16.20.2/x64/bin/npx firebase-tools@latest deploy --only hosting --project portfolio-1a12f --debug
30 Firebase CLI v13.0.2 is incompatible with Node.js v16.20.2 Please upgrade Node.js to version >=18.0.0 || >=20.0.0
32 The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npx' failed with exit code 1
33 Error: The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npx' failed with exit code 1
34 ***
35 conclusion: 'failure',
36 output: ***
37 title: 'Deploy preview failed',
38 summary: "Error: The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npx' failed with exit code 1"
39 ***
40 ***

 

 

해결 방법

배포 시 firebase-tool을 12 버전으로 사용하도록 명시해주면 된다.

기본값은 lastest이므로 신규 패키지를 사용해서 발생한것으로 보인다.

 

아래 코드 중간에 firebaseToolsVersion 항목을 확인해라

# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge
'on':
  push:
    branches:
      - master
jobs:
  build_and_deploy:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [16.x]
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - run: npm ci
      - run: npm run build
      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: '${{ secrets.GITHUB_TOKEN }}'
          firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_SOMETHING }}'
          channelId: live
          projectId: somthing
          firebaseToolsVersion: 12.9.0
        env:
          FIREBASE_CLI_PREVIEWS: hostingchannels

 

 

 

https://github.com/FirebaseExtended/action-hosting-deploy

 

GitHub - FirebaseExtended/action-hosting-deploy: Automatically deploy shareable previews for your Firebase Hosting sites

Automatically deploy shareable previews for your Firebase Hosting sites - GitHub - FirebaseExtended/action-hosting-deploy: Automatically deploy shareable previews for your Firebase Hosting sites

github.com

 

'IT' 카테고리의 다른 글

oh my zsh로 업무 생산성 높히기  (1) 2024.01.21
CSS 우선순위  (0) 2024.01.09
[운영체제] 프로세스와 쓰레드  (0) 2023.10.29
[운영체제] DMA (Direct Memory Access)  (0) 2023.10.28
[컴퓨터 구조] CPU > Program Counter  (1) 2023.10.28