nuxt icon indicating copy to clipboard operation
nuxt copied to clipboard

firebase deployment failed: @css-inline/css-inline-darwin-arm64 EBADPLATFORM error

Open devcat-net opened this issue 1 year ago • 1 comments

Environment



Reproduction

No reproduction link

Describe the bug

I want to deploy my Nuxt 3 application to firebase hosting. When I run firebase deploy I get following error:

Build failed with status: FAILURE and message: npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for @css-inline/[email protected]: wanted {"os":"darwin","cpu":"arm64"} (current: {"os":"linux","cpu":"x64"})
npm ERR! notsup Valid os:   darwin
npm ERR! notsup Actual os:  linux
npm ERR! notsup Valid cpu:  arm64
npm ERR! notsup Actual cpu: x64

For setting everything up I used this tutorial from the nitro website: Nitro Firebase

Additional context

My package.json looks like this:

{
  "name": "nuxt-app",
  "private": true,
  "type": "module",
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare",
    "clean": "cd .output/server && rm -rf node_modules && npm i",
    "deploy": "NITRO_PRESET=firebase npm run build && npm run clean && firebase deploy"
  },
  "dependencies": {
    "vue": "^3.4.19",
    "vue-router": "^4.3.0"
  },
  "devDependencies": {
    "@nuxtjs/i18n": "^8.3.0",
    "@nuxtjs/seo": "^2.0.0-rc.9",
    "@nuxtjs/tailwindcss": "^6.11.4",
    "eslint": "^8.57.0",
    "firebase": "^10.10.0",
    "firebase-admin": "^12.0.0",
    "firebase-functions": "^4.9.0",
    "firebase-tools": "^13.7.1",
    "nuxt": "^3.11.2"
  }
}

Logs

Build failed with status: FAILURE and message: npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for @css-inline/[email protected]: wanted {"os":"darwin","cpu":"arm64"} (current: {"os":"linux","cpu":"x64"})
npm ERR! notsup Valid os:   darwin
npm ERR! notsup Actual os:  linux
npm ERR! notsup Valid cpu:  arm64
npm ERR! notsup Actual cpu: x64

devcat-net avatar Apr 11 '24 09:04 devcat-net

I had the same issue. https://github.com/nuxt/nuxt/issues/21393

Work around available, painful though. Delete the following code from .output/server/package.lock works for me. Screenshot 2024-05-15 at 8 10 32 AM

Chuiantw1212 avatar May 15 '24 00:05 Chuiantw1212

Would you see if you can reproduce this in pure Nitro (reproduction sandbox), and if so, raise there? 🙏

danielroe avatar May 24 '24 08:05 danielroe

Would you be able to provide a reproduction? 🙏

More info

Why do I need to provide a reproduction?

Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.

What will happen?

If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritize it based on its severity and how many people we think it might affect.

If needs reproduction labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.

How can I create a reproduction?

We have a couple of templates for starting with a minimal reproduction:

👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz 👉 https://codesandbox.io/s/github/nuxt/starter/v3-codesandbox

A public GitHub repository is also perfect. 👌

Please ensure that the reproduction is as minimal as possible. See more details in our guide.

You might also find these other articles interesting and/or helpful:

github-actions[bot] avatar May 24 '24 08:05 github-actions[bot]

This issue was closed because it was open for 7 days without a reproduction.

github-actions[bot] avatar Jun 01 '24 01:06 github-actions[bot]

I believe the library causing issue of OP in his package.json is " "@nuxtjs/seo": "^2.0.0-rc.9",

Having similar issue with 2 packages attached to Nuxt-seo package https://nuxtseo.com/nuxt-seo/getting-started/what-is-nuxt-seo

                "@css-inline/css-inline": "0.14.1",
                "@resvg/resvg-js": "2.6.2",

When using Nitro server preset: firebase, it adds in .output/server 4 packages :

  "@css-inline/css-inline":"0.14.1",
@css-inline/css-inline-win32-x64-msvc":"0.14.1",
"@resvg/resvg-js":"2.6.2"
"@resvg/resvg-js-win32-x64-msvc"

with following error message :

i functions: updating Node.js 20 (2nd Gen) function server(europe-west1)... Build failed with status: FAILURE and message: npm error code EBADPLATFORM npm error notsup Unsupported platform for @css-inline/[email protected]: wanted {"os":"win32","cpu":"x64"} (current: {"os":"linux","cpu":"x64"}) npm error notsup Valid os: win32 npm error notsup Actual os: linux npm error notsup Valid cpu: x64 npm error notsup Actual cpu: x64

Theses errors stop the deployment. Do i need to open another issue? Also similar to https://github.com/nuxt/nuxt/issues/21393 and https://github.com/unjs/nitro/issues/1367

If i try to replace manually "@css-inline/css-inline-win32-x64-msvc":"0.14.1" , by " "@css-inline/css-inline-linux-x64-gnu": "0.14.1", this time it causes error during "npm install" as my machine is on win32.

davemg3 avatar Jun 14 '24 21:06 davemg3

I have the same issue. I couldn't deploy my Nuxt 3 app on Firebase. ChatGPT gave me an advice to add the optionalDependencies in package.json but it has not helped me. "optionalDependencies": { "@css-inline/css-inline-darwin-arm64": "0.14.1", "@css-inline/css-inline-darwin-x64": "0.14.1", "@resvg/resvg-js-darwin-arm64": "2.6.2", "@resvg/resvg-js-darwin-x64": "2.6.2" },

My package.json file looks like that: { "name": "nuxt-app", "private": true, "type": "module", "scripts": { "build": "nuxt build", "dev": "nuxt dev", "generate": "nuxt generate", "preview": "nuxt preview", "postinstall": "nuxt prepare &&if [ $(uname -s) = 'Linux' ]; then rm -rf node_modules/@css-inline/css-inline-darwin-* node_modules/@resvg/resvg-js-darwin-*; fi", "deploy-fb": "firebase target:apply hosting ap-admin-sdk-nuxt-01 ap-admin-sdk-nuxt-01 && rm -rf .output/server/node_modules && cd .output/server && npm install --production --omit=dev && cd ../../ && npm run postinstall && firebase deploy" }, "optionalDependencies": { "@css-inline/css-inline-darwin-arm64": "0.14.1", "@css-inline/css-inline-darwin-x64": "0.14.1", "@resvg/resvg-js-darwin-arm64": "2.6.2", "@resvg/resvg-js-darwin-x64": "2.6.2" }, "engines": { "node": ">=18.19.0" }, "dependencies": { "@nuxt/image": "^1.7.0", "@nuxtjs/i18n": "^8.3.1", "@nuxtjs/seo": "^2.0.0-rc.10", "@pinia/nuxt": "^0.5.1", "@vueuse/core": "^10.10.0", "@vueuse/nuxt": "^10.10.0", "firebase": "^10.12.3", "firebase-admin": "^12.2.0", "firebase-functions": "^5.0.1", "nuxt": "^3.11.2", "nuxt-viewport": "^2.1.5", "pinia": "^2.1.7", "vue": "^3.4.27", "vue-router": "^4.3.2" }, "devDependencies": { "autoprefixer": "^10.4.19", "nuxt-icon": "^0.6.10", "postcss": "^8.4.38", "sass": "^1.77.4" } }

alexpilugin avatar Jul 08 '24 13:07 alexpilugin

@danielroe , is it better to open another issue or can this one be open again?

davemg3 avatar Jul 09 '24 12:07 davemg3

Please open a new issue. Ideally, would you see if you can reproduce this in pure Nitro (reproduction sandbox), and if so, raise there? 🙏

danielroe avatar Jul 09 '24 12:07 danielroe

@danielroe , ok it did... but i dont see how to reproduce the bug in stackblitz as the issue appear when deploying from a local host (win 32 ) to linux server. Otherwise it works locally...https://github.com/unjs/nitro/issues/2604

davemg3 avatar Jul 09 '24 15:07 davemg3

@davemg3 Fantastic - thank you.

danielroe avatar Jul 15 '24 13:07 danielroe

I use the version "@nuxtjs/seo": "^2.0.0-rc.23".

I had the same problem, and in my case I needed to disable the nuxt seo ogImage in nuxt.config.ts:

export default defineNuxtConfig({
...
ogImage: {
enabled: false,
},

I haven't researched deeply to find out the reason for the problem, but for now since I don't use ogImage, this works for now.

Also consider removing the lock files from yarn or npm before deploying to firebase.

Then build and then deploy.

marcosgomesneto avatar Oct 01 '24 22:10 marcosgomesneto