nrkno / sofie-atem-connection

Sofie ATEM Connection: A Part of the Sofie TV Studio Automation System
https://github.com/nrkno/Sofie-TV-automation/
MIT License
129 stars 36 forks source link

Other: can't successfully start node app on a server #166

Open B-R-Bender opened 1 month ago

B-R-Bender commented 1 month ago

About me

Hello! I'm just a developer :)

Issue

I'm trying to build a simple controller for my ATEM. On a dev computer it looks like it works, but when I build it and deployed to a server. When I run my script it can see this in the output:

Error: Failed to find binding for freetype2 Tried paths:

  • /home/www/dv2/services/services-test/build/Debug/freetype2.node
  • /home/www/dv2/services/services-test/build/Release/freetype2.node
  • /home/www/dv2/services/services-test/prebuilds/freetype2-linux-x64/node-napi-v7.node at p (/home/www/dv2/services/services-test/main.js:2:261957) at h (/home/www/dv2/services/services-test/main.js:2:262060) at Object.4387 (/home/www/dv2/services/services-test/main.js:2:1974) at webpack_require (/home/www/dv2/services/services-test/main.js:2:353533) at Object.3278 (/home/www/dv2/services/services-test/main.js:2:229023) at webpack_require (/home/www/dv2/services/services-test/main.js:2:353533) at Object.6146 (/home/www/dv2/services/services-test/main.js:2:2278) at webpack_require (/home/www/dv2/services/services-test/main.js:2:353533) at Object.9765 (/home/www/dv2/services/services-test/main.js:2:219922) at webpack_require (/home/www/dv2/services/services-test/main.js:2:353533)

to me it looks like there is something with freetype2 on a server but maybe I'm missing something, so can you please share your thoughts.

Thanks in advance

Julusian commented 1 month ago

This library uses another library called 'freetype2' to do some text rendering, and as you have discovered, webpack doesn't understand and copy the precompiled component of this when bundling.

You will need to make sure that after your webpack build, you make the file it is looking for at /home/www/dv2/services/services-test/prebuilds/freetype2-linux-x64/node-napi-v7.node available to it. Inside of your node_modules, will be a package @julusian/freetype2 which contains the prebuilds/freetype2-linux-x64/node-napi-v7.node file that you need to distribute.

B-R-Bender commented 1 month ago

Thank you for a quick answer! I'll try and let you know if something will go wrong.