ddvk / rmfakecloud

host your own cloud for the remarkable
GNU Affero General Public License v3.0
789 stars 68 forks source link

fail to build vite UI? #344

Closed martinetd closed 4 days ago

martinetd commented 4 days ago

I'm trying to package the 0.0.22 for nixpkgs because of the regression described in #330, but the UI also got updated to vite apparently? and I can't seem to be able to build it manually.

Installed pnpm, tsc and nodejs, cleaning repo and building fails as follow:

$ pnpm --version
tsc9.12.2
$ tsc --version
Version 5.6.3
$ node --version
v20.17.0

$ git clean -fxd ui
Removing ui/build.orig/
Removing ui/build/
Removing ui/node_modules/
Removing ui/yarn.lock.orig

$ make ui/dist
mkdir -p ui/node_modules
cd ui; pnpm i
Lockfile is up to date, resolution step is skipped
Packages: +279
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 279, reused 279, downloaded 0, added 279, done

dependencies:
+ bootstrap 5.3.3
+ jwt-decode 4.0.0
+ moment 2.30.1
+ react 18.3.1
+ react-arborist 3.4.0
+ react-bootstrap 2.10.5
+ react-dom 18.3.1
+ react-dropzone 14.3.5
+ react-icons 5.3.0
+ react-pdf 9.1.1
+ react-router-dom 5.3.4
+ react-toastify 10.0.6

devDependencies:
+ @eslint/js 9.15.0
+ @types/react 18.3.12
+ @types/react-dom 18.3.1
+ @vitejs/plugin-react-swc 3.7.1
+ eslint 9.15.0
+ eslint-plugin-react-hooks 5.0.0
+ eslint-plugin-react-refresh 0.4.14
+ globals 15.12.0
+ sass-embedded 1.81.0
+ typescript 5.6.3
+ typescript-eslint 8.15.0
+ vite 5.4.11

Done in 2.6s
#@cp ui/node_modules/pdfjs-dist/build/pdf.worker.js ui/public/
cd ui; pnpm build

> ui@0.1.0 build /home/asmadeus/rmfakecloud/ui
> tsc -b && vite build

vite v5.4.11 building for production...
transforming (19) node_modules/.pnpm/react-pdf@9.1.1_@types+react@18.3.12_react-dom@18.3.1_react@1node:events:497
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at afterWriteDispatched (node:internal/stream_base_commons:161:15)
    at writeGeneric (node:internal/stream_base_commons:152:3)
    at Socket._writeGeneric (node:net:954:11)
    at Socket._write (node:net:966:8)
    at writeOrBuffer (node:internal/streams/writable:570:12)
    at _write (node:internal/streams/writable:499:10)
    at Writable.write (node:internal/streams/writable:508:10)
    at AsyncCompiler.writeStdin (/home/asmadeus/rmfakecloud/ui/node_modules/.pnpm/sass-embedded@1.81.0/node_modules/sass-embedded/dist/lib/src/compiler/async.js:60:28)
    at PacketTransformer.writeInboundBuffer (/home/asmadeus/rmfakecloud/ui/node_modules/.pnpm/sass-embedded@1.81.0/node_modules/sass-embedded/dist/lib/src/compiler/async.js:114:18)
    at PacketTransformer.writeInboundProtobuf (/home/asmadeus/rmfakecloud/ui/node_modules/.pnpm/sass-embedded@1.81.0/node_modules/sass-embedded/dist/lib/src/packet-transformer.js:68:18)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}

Node.js v20.17.0
 ELIFECYCLE  Command failed with exit code 1.
make: *** [Makefile:48: ui/dist] Error 1

This looks more like an error in a dep (react-pdf) due to version problem than something rmfakecloud can do about it (running pnpm update didn't help either), but if someone knows what this is about any help is appreciated..

martinetd commented 4 days ago

Grmbl after looking a bit it looks like the problem is some executable that's not running, because pnpm build goes download some random binary from the internet and these don't run in nixos (in this case, .../rmfakecloud/ui/node_modules/.pnpm/sass-embedded-linux-x64@1.81.0/node_modules/sass-embedded-linux-x64/dart-sass/src/dart)

I guess I'll have to figure out how to make pnpm build not try to run downloaded binaries :/

Probably not today though.. Anyway, closing this as it's not really rmfakecloud at fault here, let me just say I hate the javascript ecosystem...

martinetd commented 4 days ago

done: https://github.com/NixOS/nixpkgs/pull/358324

if anyone stumbles on this, apparently just removing the node_modules/sass-embedded directory works around the problem /shrug