WatchItDev / watchit-app

Open movies everywhere
https://watchit.movie
GNU Affero General Public License v3.0
331 stars 35 forks source link

Compiling with Node 22.3 #192

Closed username227 closed 1 month ago

username227 commented 2 months ago

When I type "yarn" after cloning the git or extracting the tarball, I get this error:

error @watchitapp/watchitapp-uix@1.0.18: The engine "node" is incompatible with this module. Expected version ">=18.0.0 <21". Got "22.3.0"

Note that I am using Arch, so it's using an updated node. I could not locate specific build instructions, so if I"m doing something wrong, please let me know. But if you can make the source code compatible with node-js 22 for compiling and let me know about any other build instructions, I could probably create an arch package for the AUR that would build from source, as some people might prefer this over an appimage package. I would be willing to maintain also.

username227 commented 1 month ago

Thank you, that does seem better. I'm most of the way there but the built app doesn't work. Would you mind giving me the build steps that you do in order to verify that i'm not doing anything wrong? thanks!

username227 commented 1 month ago

to be more specific there's something wrong with the file app.asar in dist/resources. when I replace that file with the one from the appimage it works. What am I doing wrong? I could open up a separate issue if you prefer.

geolffreym commented 1 month ago

Hey @username227.

Try adding a .env file with the following data please:

WATCHIT_DEFAULT_PDM_KEY=bafkreiaenzlqmc34crc7sfsr3wanvbdwovsgfgggm2am7lafeejn6orghi WATCHIT_DEFAULT_PDM_LABEL=Public Domain WATCHIT_PUBSUB_PEER_DISCOVERY=watchit-pubsub-discovery

After that running make packagelinux would be enough. And if you have a log to get a bit more context about the issue could help us.

Thank you

username227 commented 1 month ago

Yes, that worked perfectly. thank you! can I append an option to the command "make packagelinux" to only build the unpacked and forego the deb and appimage? thanks!

I will try to work on an arch package for the AUR based on this. thanks for your help!

geolffreym commented 1 month ago

Sure, if you want, you can add a new command for it. Close the issue when you feel ready! Thank you @username227.

username227 commented 1 month ago

OK, several things: the first command, the npm command, that sets things up - gets an error without root privileges. Not sure why, to tell the truth - but in a pkgbuild, all items need to be completed on the $srcdir, which shouldn't require root. Can you shed light on why this is happening and if there's a way around this?

Also, while I have some skills in making packages, true development and programming is a little beyond me, so I don't have the skills to add a new command to the makefile to separate the unpacked build from the appimage and deb. This is not as important as the first item, but just throwing it out there.

geolffreym commented 1 month ago

Hey @username227.

In that case please check this file https://github.com/WatchItDev/watchit-app/blob/v1.0.0/electron-builder.yml and https://www.electron.build/configuration/configuration documentation, ley me know if you need any help.

Regards

username227 commented 1 month ago

OK. I think I can patch that file before build to remove the unwanted targets pretty easily. Thanks.

What about the root issue? There's no way that I can call a root command from a pkgbuild.

geolffreym commented 1 month ago

Hey @username227. I am not sure about the issue you are facing, seems like a permissions related?

the npm command, that sets things up - gets an error without root privileges

This is because node is trying to install a global package. I removed the global flag from preinstall, try again please.

username227 commented 1 month ago

yes, it is, see error code below. This is probably the reason why it's being rejected: npm error at async moveFile (/usr/lib/node_modules/npm/node_modules/@npmcli/fs/lib/move-file.js:30:5)

I can't call root permissions inside a pkgbuild file.

npm error code EACCES npm error syscall rename npm error path /home/jerry/watchit-app/node_modules/node-stdlib-browser/node_modules/find-up npm error dest /home/jerry/watchit-app/node_modules/node-stdlib-browser/node_modules/.find-up-nb8UCFTS npm error errno -13 npm error Error: EACCES: permission denied, rename '/home/jerry/watchit-app/node_modules/node-stdlib-browser/node_modules/find-up' -> '/home/jerry/watchit-app/node_modules/node-stdlib-browser/node_modules/.find-up-nb8UCFTS' npm error at async Object.rename (node:internal/fs/promises:787:10) npm error at async moveFile (/usr/lib/node_modules/npm/node_modules/@npmcli/fs/lib/move-file.js:30:5) npm error at async Promise.allSettled (index 0) npm error at async [reifyPackages] (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:325:11) npm error at async Arborist.reify (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:142:5) npm error at async Install.exec (/usr/lib/node_modules/npm/lib/commands/install.js:150:5) npm error at async Npm.exec (/usr/lib/node_modules/npm/lib/npm.js:207:9) npm error at async module.exports (/usr/lib/node_modules/npm/lib/cli/entry.js:74:5) { npm error errno: -13, npm error code: 'EACCES', npm error syscall: 'rename', npm error path: '/home/jerry/watchit-app/node_modules/node-stdlib-browser/node_modules/find-up', npm error dest: '/home/jerry/watchit-app/node_modules/node-stdlib-browser/node_modules/.find-up-nb8UCFTS' npm error } npm error npm error The operation was rejected by your operating system. npm error It is likely you do not have the permissions to access this file as the current user npm error npm error If you believe this might be a permissions issue, please double-check the npm error permissions of the file and its containing directories, or try running npm error the command again as root/Administrator. npm error A complete log of this run can be found in: /home/jerry/.npm/_logs/2024-07-03T16_40_09_554Z-debug-0.log

geolffreym commented 1 month ago

Ok, just to be sure. Are you facing this issue during any specific command or during install?

username227 commented 1 month ago

only when running npm install. Once that is called with sudo (on a manual build, not with a pkgbuild file), the rest of the build works without root.

geolffreym commented 1 month ago

Ok, i sent a fix for that. The pre-install was using a -g flag installing a package globally causing the permission request. Could you try again please?

username227 commented 1 month ago

OK, yes, that did fix it. Now i'm running into another problem, which is probably not related. when I built the beta version it worked fine. But when I build based on the latest commit, which is the default branch 1.0.0, and I open the program i get a black screen and it's not rendering. running from terminal gives no error messages, though.

geolffreym commented 1 month ago

Could you try running make clean and npm ci ?

username227 commented 1 month ago

Could you try running make clean and npm ci ? I assume you mean running make clean prior to running npm ciand make packagelinux because without the third command it doesn't build anything. This produces the same black box result as before.

geolffreym commented 1 month ago

Yeah. 1- make clean to clean cache and old modules 2- npm ci reinstall

Finally you can run the command make packagelinux again.