FoxxMD / multi-scrobbler

Scrobble plays from multiple sources to multiple clients
https://foxxmd.github.io/multi-scrobbler
MIT License
299 stars 14 forks source link

Error: Your current platform "freebsd" and architecture "x64" combination is not yet supported by the native Rollup build #135

Closed wynkenstein closed 4 months ago

wynkenstein commented 5 months ago

Hi there,

after trying to install latest build (0.6.4) on FreeBSD i got the following error when running npm run build :

Error: Your current platform "freebsd" and architecture "x64" combination is not yet supported by the native Rollup build. Please use the WASM build "@rollup/wasm-node" instead.

The following platform-architecture combinations are supported: android-arm android-arm64 darwin-arm64 darwin-x64 linux-arm linux-arm64 linux-arm64 (musl) linux-riscv64 linux-x64 linux-x64 (musl) win32-arm64 win32-ia32 win32-x64

my attempted solution was changing a part of the package.json at the overrides section to:

"overrides": { "spotify-web-api-node": { "superagent": "$superagent" }, "rollup": "npm:@rollup/wasm-node" }

but still no luck. Now the error message for npm run build reads:

multi-scrobbler@0.6.4 build APP_VERSION=$npm_package_version vite build

node:internal/modules/esm/resolve:844 throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null); ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'rollup' imported from /usr/home/stuff/installs/multi-scrobbler/node_modules/vite/dist/node/cli.js at packageResolve (node:internal/modules/esm/resolve:844:9) at moduleResolve (node:internal/modules/esm/resolve:901:20) at defaultResolve (node:internal/modules/esm/resolve:1121:11) at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12) at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25) at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38) at ModuleWrap. (node:internal/modules/esm/module_job:85:39) at link (node:internal/modules/esm/module_job:84:36) { code: 'ERR_MODULE_NOT_FOUND' }

Node.js v20.10.0

FoxxMD commented 5 months ago

I'm guessing you got the override from this issue? Try removing the npm: prefix:

  "overrides": {
    "spotify-web-api-node": {
      "superagent": "$superagent"
    },
    "rollup": "@rollup/wasm-node"
  }
wynkenstein commented 5 months ago

Thanks for replying. I already tried that, with the same result.

FoxxMD commented 5 months ago

Ah I think I may have given you the wrong structure for overrides there. We need to tell npm to override a depedency of vite, not rollup itself.

First...try this one:

{
  "overrides": {
    "spotify-web-api-node": {
      "superagent": "$superagent"
    },
    "vite": {
      "rollup": "@rollup/wasm-node"
    }
  }
}

If that doesn't work then try this:

{
  "devDependencies": {
    "@rollup/wasm-node": "^4.9.6"
   // ...
  },
  "overrides": {
    "spotify-web-api-node": {
      "superagent": "$superagent"
    },
    "vite": {
      "rollup": "$@rollup/wasm-node"
    }
  }
}

In both cases try to do an update first: npm update && npm install

If neither of those work you could also try using pnpm and the solution given in that issue. Maybe pnpm has additional functionality for overrides that npm does not.

P.S. the reason this is breaking now is due to changing from CRA to Vite in the last release.

wynkenstein commented 4 months ago

I tried all possible solutions (both with npm and pnpm) but it still doesn't work. The last error (trying the second solution with pnpm) reads:

> multi-scrobbler@0.6.4 build /usr/home/stuff/installs/multi-scrobbler
> APP_VERSION=$npm_package_version vite build

/usr/home/stuff/installs/multi-scrobbler/node_modules/.pnpm/rollup@4.9.6/node_modules/rollup/dist/native.js:38
        throw new Error(
              ^

Error: Your current platform "freebsd" and architecture "x64" combination is not yet supported by the native Rollup build. Please use the WASM build "@rollup/wasm-node" instead.

The following platform-architecture combinations are supported:
android-arm
android-arm64
darwin-arm64
darwin-x64
linux-arm
linux-arm64
linux-arm64 (musl)
linux-riscv64
linux-x64
linux-x64 (musl)
win32-arm64
win32-ia32
win32-x64

If this is important to you, please consider supporting Rollup to make a native build for your platform and architecture available.
    at Object.<anonymous> (/usr/home/stuff/installs/multi-scrobbler/node_modules/.pnpm/rollup@4.9.6/node_modules/rollup/dist/native.js:38:8)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:345:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:294:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)

Node.js v20.10.0
ELIFECYCLE  Command failed with exit code 1.
FoxxMD commented 4 months ago

Maybe this comment will help? The version of vite MS uses specifies rollup^4.2.0 so try specifying a higher version?

"overrides": {
  "vite": {
    "rollup": "npm:@rollup/wasm-node@^4.9.6"
  }
}

EDIT: this seems to work for me! Using the above overrides and then npm update then shows that node_modules/rollup/package.json is @rollup/wasm-node

wynkenstein commented 4 months ago

Nice find, thank you! I cleared everything and did a fresh install and build with npm, only adding the vite override with specific version and now it works.

> multi-scrobbler@0.6.4 build
> APP_VERSION=$npm_package_version vite build

vite v5.0.12 building for production...

There are some "Deprecation Warning" in the process like for example:

    src/client/components/player/trackInfo.scss 64:8  root stylesheet

Deprecation Warning: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($spacing, 2) or calc($spacing / 2)

More info and automated migrator: https://sass-lang.com/d/slash-div

but I guess it's fine for now.

FoxxMD commented 4 months ago

The deprecation warnings are normal and unrelated to rollup -- just some things i need to fix in the css being built. Glad its working! I'm going to try to get some more information on rollup/wasm-node to see if I can officially replace rollup with it or if it should only be a stopgap: https://github.com/rollup/rollup/discussions/5378

juliusiqbal commented 3 months ago

I had to use below code in package.json file and remove node_modules folder and run npm install.

"overrides": {
    "vite": {
      "rollup": "npm:@rollup/wasm-node"
    }
  }

I had to run below commands for dockerized app where npm i should run inside container.

docker compose run reusebin-ui npm i && \
  docker compose down && \
  rm -rf node_modules && \
  docker compose up --build