Nuxt firebase 部署错误:npm ERR! notsup 不支持的平台

问题描述 投票:0回答:1

我正在尝试使用 GitHub actions 将我的 Nuxt 3 网站部署到 firebase,但失败并出现以下错误:

Other logs here...
i  hosting: upload complete
✔  hosting[magpiethebrand]: file upload complete
i  functions: updating Node.js 18 (2nd Gen) function nuxt:server(europe-west3)...
Build failed with status: FAILURE and message: npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for @css-inline/[email protected]: wanted {"os":"linux","cpu":"x64","libc":"musl"} (current: {"os":"linux","cpu":"x64","libc":"glibc"})
npm ERR! notsup Valid os:    linux
npm ERR! notsup Actual os:   linux
npm ERR! notsup Valid cpu:   x64
npm ERR! notsup Actual cpu:  x64
npm ERR! notsup Valid libc:  musl
npm ERR! notsup Actual libc: glibc

这是我的工作流程:

name: firebase Continuous Deployment

on:
  push:
    branches: [master]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - uses: actions/setup-node@master
        with:
          node-version: 20
      - run: npm ci
      - run: npm run build
      - uses: w9jds/firebase-action@master
        with: 
          args: deploy
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

我该如何解决这个问题?

我还尝试通过以下方式修复它:

name: firebase Continuous Deployment

on:
  push:
    branches: [master]

jobs:
  deploy:
    runs-on: ubuntu-latest
    container:
      image: ekidd/rust-musl-builder:stable
      options: --privileged
    steps:
      - uses: actions/checkout@master
      - uses: actions/setup-node@master
        with:
          node-version: 20
      - run: npm ci
      - run: npm run build
      - uses: w9jds/firebase-action@master
        with: 
          args: deploy
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

我按照chatGPT的指示添加了容器镜像,但收到以下错误:

/__e/node20/bin/node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /__e/node20/bin/node)
firebase nuxt.js github-actions nuxtjs3
1个回答
0
投票

您正在使用一个包 @css-inline/css-inline-linux-x64-musl,该包是为使用 musl(C 库)的 Linux 系统制作的,但您的作业运行在使用 的 ubuntu-latest 上glibc(另一个 C 库)。

然后,您尝试使用使用musl的容器,但节点本身需要glibc

我不知道你到底想用这个 @css-inline/css-inline-linux-x64-musl 包实现什么(为什么在 javascript 项目中使用 C 来 inline-css ?),但我建议你删除它并且您使用 Nuxt 自己的方式来内联 css。更多信息这里

如果这对您不起作用,也许您应该为包选择 不同的架构

© www.soinside.com 2019 - 2024. All rights reserved.