Popcorn-desktop: Freeze on bootstrap: Cannot find module '../../package.json'

Created on 29 Jun 2020  ·  15Comments  ·  Source: popcorn-official/popcorn-desktop

Operating System Version:
Linux Ubuntu 20.04

Popcorn Time Version:
Popcorn Desktop 0.4.4

Download date:
Today 2020-06-29

Download url (optional):
https://get.popcorntime.app/build/Popcorn-Time-0.4.4-linux64.zip

Expected Behaviour

Expected the app to start normally.

Actual Behaviour

The blue progress bar stops indefinitely and the message "Loading stuck ? Click here !" is displayed at the bottom of the window (but clicking the message does nothing)

Steps to reproduce the behaviour

  1. Donwload
  2. Unzip
  3. Launch ./Popcorn-Time

Error from developer console

Error in console output at localhost:9222:

Uncaught Error: Cannot find module '../../package.json'
Require stack:
- /src/app/index.html
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1000)
    at Function.Module._load (internal/modules/cjs/loader.js:878)
    at Module.require (internal/modules/cjs/loader.js:1060)
    at require (internal/modules/cjs/helpers.js:72)
    at self.require (<anonymous>:11:26)
    at self.require (<anonymous>:11:26)
    at loadFromPackageJSON (bootstrap.js:64)
    at loadNpmSettings (bootstrap.js:86)
    at bootstrap.js:100
    at bootstrap.js:132

After digging a little in what happened, modifying the source code as follow:
require("../../package.json") -> require("package.json")
solves this specific error but then other imports fail during the rest of the bootstrap.

For some reason require seems to resolve the relative imports in bootstrap.js from . (the root app folder) and not from the ./src/app/ folder where the main index.html is.

Most helpful comment

Ok, thank you for testing in French, it pointed me in the right direction. So my system is in French but as a developer I use the terminal a lot and need to have my terminal in English (mainly when searching for error messages, much easier in English) so I had the following in my .bashrc:

export LC_ALL=C
export LANG=en_US.UTF-8

That worked mostly fine since I put it there some years ago. I must say I noticed that one Ubuntu upgrade (maybe 20.04 but possibly a previous one) mangled folder names when using the cd autocompletion though it displayed just fine after execution, so I didn't pay much attention:

maxime@max230 ~ 
$ cd T\303\251l\303\251chargements/
maxime@max230 ~/Téléchargements 
$ 

Turns out that LC_ALL=C is ASCII only and doesn't work well with special characters... A little digging on askubuntu and stackexchange made me try export LC_ALL=C.UTF-8 instead and guess what ?
Issue solved!

I guess you should now be able to reproduce the issue by just running LC_ALL=C ./Popcorn-Time. Is that the case?

Thank you very much for your patience and help while investigating this issue!

All 15 comments

This seems the issue:

> require.resolve.paths('../../package.json')
["/src/app"]

Obviously this folder does not exist...
Whereas on a test app I just made with a similar structure:

> require.resolve.paths('../../package.json')
["/home/maxime/github/test/nwjs_import_pkg_json/src/app"]

hhmm... this one sound weird. Can someone reproduce the error ? (I haven't migrated to 20.04 already :/)

Still not migrated to 20.04, but i should in next days/weeks... just keeping you informed

Have finally migrated to Xubuntu 20.04.

cannot reproduce:

~/Downloads/PT_test/Popcorn-Time-0.4.4-linux64 $ ./Popcorn-Time 

DevTools listening on ws://127.0.0.1:9222/devtools/browser/a7fed05a-4c3f-42fc-be53-b3ab2a39cb5d
[1214817:1214817:1022/002126.135739:ERROR:sandbox_linux.cc(376)] InitializeSandbox() called with multiple threads in process gpu-process.
(node:1214833) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

and it works as expected.

Can you eventually provides the terminal output ?

Redownloading the v0.4.4 still fails for me. The terminal ouput is as follow:

$ ./Popcorn-Time 
[2220813:2220813:1026/020704.322424:ERROR:edid_parser.cc(102)] Too short EDID data: manufacturer id
[2220813:2220813:1026/020704.322686:ERROR:edid_parser.cc(102)] Too short EDID data: manufacturer id

DevTools listening on ws://127.0.0.1:9222/devtools/browser/2d79c6d4-b3fc-461e-a1df-4e1394efb5ab
[2220838:2220838:1026/020704.490097:ERROR:sandbox_linux.cc(376)] InitializeSandbox() called with multiple threads in process gpu-process.
(node:2220853) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[2220838:2220838:1026/020714.962049:ERROR:gl_surface_presentation_helper.cc(259)] GetVSyncParametersIfAvailable() failed for 1 times!

The devtools log is more helpful (still the same issue):

Database path: /home/maxime/.config/Popcorn-Time/Default
app.js:17 [INFO] Scanning: Local Network for Airplay devices
app.js:17 [INFO] Scanning: Local Network for DLNA devices
app.js:17 [INFO] Scanning: Local Network for Chromecast devices
app.js:17 [INFO] Scanning: /usr/bin
app.js:17 [INFO] Scanning: /usr/local/bin
app.js:17 [INFO] Scanning: /snap/bin
app.js:17 [INFO] Found External Player: mplayer in /usr/bin
app.js:17 [INFO] Found External Player: VLC in /usr/bin
app.js:17 [INFO] External Players: scan finished
app.js:17 [INFO] Window out of view, recentering y-pos
internal/modules/cjs/loader.js:1003 Uncaught Error: Cannot find module '../../package.json'
Require stack:
- /src/app/index.html
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1000)
    at Function.Module._load (internal/modules/cjs/loader.js:878)
    at Module.require (internal/modules/cjs/loader.js:1060)
    at require (internal/modules/cjs/helpers.js:72)
    at self.require (<anonymous>:11:26)
    at self.require (<anonymous>:11:26)
    at loadFromPackageJSON (bootstrap.js:64)
    at loadNpmSettings (bootstrap.js:86)
    at bootstrap.js:100
    at bootstrap.js:132
app.js:17 [INFO] Loading DB
app.js:201 Couldn't start app:  TypeError: Cannot read property 'then' of undefined
    at Object.initialize (database.js:396)
    at n.onAttach (main_window.js:229)
    at n.s (trigger-method.js:36)
    at n.triggerMethod (view.js:189)
    at r (trigger-method.js:51)
    at constructor._attachView (region.js:127)
    at constructor.show (region.js:79)
    at constructor.showView (application.js:46)
    at initApp (app.js:199)
    at Promise_then_fulfilled (/home/maxime/Téléchargements/Popcorn-Time-0.4.4-linux64(1)/node_modules/q/q.js:766:44) TypeError: Cannot read property 'then' of undefined
    at Object.initialize (chrome-extension://hecfofbbdfadifpemejbbdcjmfmboohj/src/app/database.js:396:14)
    at n.onAttach (chrome-extension://hecfofbbdfadifpemejbbdcjmfmboohj/src/app/lib/views/main_window.js:229:14)
    at n.s (chrome-extension://hecfofbbdfadifpemejbbdcjmfmboohj/node_modules/backbone.marionette/lib/backbone.marionette.min.js:12:528)
    at n.triggerMethod (chrome-extension://hecfofbbdfadifpemejbbdcjmfmboohj/node_modules/backbone.marionette/lib/backbone.marionette.min.js:12:14330)
    at r (chrome-extension://hecfofbbdfadifpemejbbdcjmfmboohj/node_modules/backbone.marionette/lib/backbone.marionette.min.js:12:725)
    at constructor._attachView (chrome-extension://hecfofbbdfadifpemejbbdcjmfmboohj/node_modules/backbone.marionette/lib/backbone.marionette.min.js:12:16494)
    at constructor.show (chrome-extension://hecfofbbdfadifpemejbbdcjmfmboohj/node_modules/backbone.marionette/lib/backbone.marionette.min.js:12:15804)
    at constructor.showView (chrome-extension://hecfofbbdfadifpemejbbdcjmfmboohj/node_modules/backbone.marionette/lib/backbone.marionette.min.js:12:48484)
    at initApp (chrome-extension://hecfofbbdfadifpemejbbdcjmfmboohj/src/app/app.js:199:9)
    at Promise_then_fulfilled (/home/maxime/Téléchargements/Popcorn-Time-0.4.4-linux64(1)/node_modules/q/q.js:766:44)
initApp @ app.js:201

@blaze33 ok, it seem you have a "too short EDID data" issue. Are you running PCT in a VM or something ?

what if you run PCT with --disable-gpu argument instead.

No VM, i run PCT directly on my laptop, --disable-gpu doesn't solve the issue.

$ ./Popcorn-Time --disable-gpu
[10058:10058:1028/171544.172919:ERROR:edid_parser.cc(102)] Too short EDID data: manufacturer id
[10058:10058:1028/171544.173232:ERROR:edid_parser.cc(102)] Too short EDID data: manufacturer id

DevTools listening on ws://127.0.0.1:9222/devtools/browser/d48970bf-fdfc-4c03-a13c-f1afd374d145
(node:10100) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

If that helps also:

$ sudo get-edid | parse-edid
This is read-edid version 3.0.2. Prepare for some fun.
Attempting to use i2c interface
No EDID on bus 1
No EDID on bus 2
No EDID on bus 4
No EDID on bus 6
No EDID on bus 7
No EDID on bus 8
No EDID on bus 9
3 potential busses found: 0 3 5
Will scan through until the first EDID is found.
Pass a bus number as an option to this program to go only for that one.
Bus 0 doesn't really have an EDID...
256-byte EDID successfully retrieved from i2c bus 3
Looks like i2c was successful. Have a good day.
Checksum Correct

Section "Monitor"
    Identifier ""
    ModelName ""
    VendorName "AUO"
    # Monitor Manufactured week 0 of 2010
    # EDID version 1.4
    # Digital Display
    DisplaySize 280 160
    Gamma 2.20
    Option "DPMS" "false"
    Modeline    "Mode 0" 69.30 1366 1414 1446 1454 768 771 777 793 -hsync -vsync 
EndSection

Just tried on fresh install of Ubuntu 20.04 (...in a VM because i don't want to trash my system, but it isn't important here)

And it still works, it just needed libatomic1 package (it was throwing a libatomic1 lib error...).

So I don't know why it isn't working on your machine.

Have you tried to delete (eventually backup it somewhere first) your config profil (~/.config/Popcorn-Time/) ?

@blaze33 Are you still around ?

I'm reading again the issue, I don't have much explanantion but maybe we can check some things together.

Apparently you run PCT from your Téléchargements folder and the extraction folder is Popcorn-Time-0.4.4-linux64(1), both have spécials characters "é" and "parenthesis".

Can you try by moving PCT somewhere else maybe in /home/maxime/pct-test for example ?

Closing, see #1546 for status on this.

Hi @Persei08, I'm still around ;)

I tried deleting the PCT config profile ~/.config/Popcorn-Time/ but it did not solve the issue.

However your last comment about the special characters in the folder name was spot on. Moving the PCT files to /home/maxime/pct-test just solved the issue! Damn Téléchargement, I guess we can file this issue as a French only bug ;)

Not sure how this could be solved though but the workaround is good enough for me.
Thanks for the support!

Damn Téléchargement, I guess we can file this issue as a French only bug ;)

Well, I'm not sure.
I tried in my Téléchargements folder and don't get the issue, but my system is set to english language by default... will switch back to French, retry and tell you more.

Ok, just tried, for me it works with default language set to French and app being in ~/Téléchargements/Popcorn-Time-0.4.4-linux64(1)

can your run locale and localectl status commands, so we compare our settings please ?

Mine are:

anto@desk-ubu:~/Téléchargements/Popcorn-Time-0.4.4-linux64(1) $ locale
LANG=fr_FR.UTF-8
LANGUAGE=fr_FR:en_GB:en
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC=fr_FR.UTF-8
LC_TIME=fr_FR.UTF-8
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY=fr_FR.UTF-8
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER=fr_FR.UTF-8
LC_NAME=fr_FR.UTF-8
LC_ADDRESS=fr_FR.UTF-8
LC_TELEPHONE=fr_FR.UTF-8
LC_MEASUREMENT=fr_FR.UTF-8
LC_IDENTIFICATION=fr_FR.UTF-8
LC_ALL=
anto@desk-ubu:~/Téléchargements/Popcorn-Time-0.4.4-linux64(1) $ localectl status
   System Locale: LANG=fr_FR.UTF-8
                  LANGUAGE=fr_FR:en_GB:en
       VC Keymap: n/a
      X11 Layout: fr
       X11 Model: pc105
     X11 Variant: azerty

Ok, thank you for testing in French, it pointed me in the right direction. So my system is in French but as a developer I use the terminal a lot and need to have my terminal in English (mainly when searching for error messages, much easier in English) so I had the following in my .bashrc:

export LC_ALL=C
export LANG=en_US.UTF-8

That worked mostly fine since I put it there some years ago. I must say I noticed that one Ubuntu upgrade (maybe 20.04 but possibly a previous one) mangled folder names when using the cd autocompletion though it displayed just fine after execution, so I didn't pay much attention:

maxime@max230 ~ 
$ cd T\303\251l\303\251chargements/
maxime@max230 ~/Téléchargements 
$ 

Turns out that LC_ALL=C is ASCII only and doesn't work well with special characters... A little digging on askubuntu and stackexchange made me try export LC_ALL=C.UTF-8 instead and guess what ?
Issue solved!

I guess you should now be able to reproduce the issue by just running LC_ALL=C ./Popcorn-Time. Is that the case?

Thank you very much for your patience and help while investigating this issue!

Great. It's satisfying to finally know what caused that.

Ok, thank you for testing in French, it pointed me in the right direction. So my system is in French but as a developer I use the terminal a lot and need to have my terminal in English (mainly when searching for error messages, much easier in English)

As a french too I understand, it's the same reason for me... but I keep some LC_* in french (mois, jour, devises, unités de mesures, etc...).

My usual settings:

anto@desk-ubu:~ $ locale
LANG=en_GB.UTF-8
LANGUAGE=en_GB:en
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC=fr_FR.UTF-8
LC_TIME=fr_FR.UTF-8
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY=fr_FR.UTF-8
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER=fr_FR.UTF-8
LC_NAME=fr_FR.UTF-8
LC_ADDRESS=fr_FR.UTF-8
LC_TELEPHONE=fr_FR.UTF-8
LC_MEASUREMENT=fr_FR.UTF-8
LC_IDENTIFICATION=fr_FR.UTF-8
LC_ALL=

you should now be able to reproduce the issue by just running LC_ALL=C ./Popcorn-Time. Is that the case?

Yes, I reproduce the issue ;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LKHN picture LKHN  ·  5Comments

Villelmo picture Villelmo  ·  4Comments

kumavis picture kumavis  ·  5Comments

bewakertje picture bewakertje  ·  3Comments

benjavalero picture benjavalero  ·  4Comments