Crash when I open my app

  1. Hi Developers, I’m trying to create my first app for webOS, I’m using Enact https://enactjs.com/docs/ , I create the build for my app with: enact pack -p and then to the directory of that build I run ares-package ./dist, to generate my .ipk

I install is .ipk to my tv, via webOS dev Manager and Dev mode on my tv. But when I try to open my app it doesn’t even open, the screen of my tv stays black.

We do not debug app issues. Please check again with the samples we provide. Thank you.

The answers from moderators in this forum amaze me :wink:

I had the same problem and found out that the application created with the latest developer tools fails with the following error in the console, when run on a webOS 5.x TV:

Uncaught ReferenceError: globalThis is not defined

Adding the package globalthis to the project and requiring it at the top of index.js fixed the problem, and the application started without errors.

In shell:

npm install globalthis --save

The index.js file:

require('globalthis/auto');
/* the rest of your index.js file */
import React from 'react';

I hope that helps.

It sounds like you’ve done the initial setup correctly, but the black screen issue could be related to a few common pitfalls when deploying Enact apps on webOS. Here are some troubleshooting steps to try:

  1. Check Console Logs: Connect to your TV using ares-inspect or ares-log to capture console logs when you attempt to open the app. This can give you clues if there are any missing dependencies or runtime errors causing the black screen.
  2. Verify webOS Compatibility: Make sure the Enact version you’re using is compatible with the version of webOS on your TV. Sometimes, libraries or APIs in newer Enact versions may not be fully supported on older webOS versions.
  3. Double-check package.json and appinfo.json: Ensure that both files have the correct configurations and dependencies for your app. Missing or incorrect values can sometimes prevent the app from loading.
  4. Test with a Simple App: Try deploying a basic Enact app without additional customizations to see if it launches. If it does, you can gradually add components to isolate the issue.
  5. Check Dev Mode Permissions: Sometimes, Dev Mode on the TV needs to be restarted to refresh permissions, especially after multiple installations.

If none of these steps work, you could also try reaching out on the Enact or webOS developer forums, where other developers may have encountered similar issues. Good luck with your first webOS app!