Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Webkit throws error when packaged within Node Modules using Electron-Packager #5472

Closed
adwam12 opened this issue Feb 16, 2021 · 5 comments · Fixed by #5512 or #5540
Closed

[BUG] Webkit throws error when packaged within Node Modules using Electron-Packager #5472

adwam12 opened this issue Feb 16, 2021 · 5 comments · Fixed by #5512 or #5540
Assignees

Comments

@adwam12
Copy link

adwam12 commented Feb 16, 2021

Context:

  • Playwright Version: 1.8.1
  • Operating System: Mac
  • Node.js version: 14.11.0
  • Browser: WebKit
  • Extra: Launching a playwright script from Electron
  System:
    OS: macOS 10.15.7
    Memory: 79.50 MB / 8.00 GB
  Binaries:
    Node: 14.11.0 - /usr/local/bin/node
    npm: 6.14.8 - /usr/local/bin/npm
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    playwright: ^1.8.1 => 1.8.1 

Describe the bug
I am working on an Electron app that launches Playwright webkit. The app is being packaged and should work without the user installing playwright themselves. I have packaged the browsers in Node Modules using "PLAYWRIGHT_BROWSERS_PATH=0" and set "process.env.PLAYWRIGHT_BROWSERS_PATH = 0" in my main.js.

Everything works on my local machine but when trying to package the app using Electron-Packager i get the following error:


> InstaBot@1.0.0 package-mac /Users/adamlosgood/development/CleanScraper
> electron-packager . --overwrite --platform=darwin --arch=x64  --prune=true --out=release-builds

Packaging app for platform darwin x64 using electron v4.1.4
ENOENT: no such file or directory, stat 'node_modules/playwright/.local-browsers/webkit-1423/WebKitLegacy.framework/WebKitPluginAgent'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! InstaBot@1.0.0 package-mac: `electron-packager . --overwrite --platform=darwin --arch=x64  --prune=true --out=release-builds`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the InstaBot@1.0.0 package-mac script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/adamlosgood/.npm/_logs/2021-02-16T14_31_17_329Z-debug.log

I do have .local-browsers/webkit-1423/WebKitLegacy.framework/WebKitPluginAgent in my Node Modules. Everything works fine, and the app can be packaged if the Playwright browsers are installed outside of Node Modules but this will not work for my purpose.

I have already tried deleting and reinstalling my node modules. My issue seems vaguely similar to #2539 and #1988 but none of the offered solutions helped and my problem seemed different enough to warrant a new issue.

Any help would be GREATLY appreciated, as I've been stuck on this for quite a while.

@aslushnikov
Copy link
Contributor

@adwam12 I think you can safely remove .local-browsers/webkit-1423/WebKitLegacy.framework/WebKitPluginAgent - it's a broken symlink. I believe we don't ship WebKitPluginAgent with our webkit since there's no use for it.

@adwam12
Copy link
Author

adwam12 commented Feb 19, 2021

@aslushnikov Thank you for the suggestion. I tried deleting that file and the error changed to:
ENOENT: no such file or directory, stat 'node_modules/playwright/.local-browsers/webkit-1423/WebKit.framework/XPCServices/com.apple.WebKit.WebAuthn.xpc'
That file also exists and is also a symbolic link.

I tried recreating a minimal project with just playwright and electron-packager and the error remains.

@aslushnikov
Copy link
Contributor

aslushnikov commented Feb 19, 2021

@adwam12 so from-inside the webkit-1423 directory, you can do the following:

.local-browsers/webkit-1423$ find . -type l ! -exec test -e {} \; -print
./WebCore.framework/Frameworks
./WebKitLegacy.framework/WebKitPluginAgent
./WebKit.framework/Versions/A/XPCServices/com.apple.WebKit.WebAuthn.xpc
./WebKit.framework/Versions/A/XPCServices/com.apple.WebKit.GPU.xpc

These are all the broken symlinks inside the webkit. You can freely remove them all - it should fix the problem. A one-liner for this would be:

.local-browsers/webkit-1423$ find . -type l ! -exec test -e {} \; -print | xargs rm

Could you please try and tell if it helped?

aslushnikov added a commit to aslushnikov/playwright that referenced this issue Feb 19, 2021
Since we don't ship things like WebKitPluginAgent, we can
safely remove all the symlinks that point to the missing targets.

Fixes microsoft#5472
@aslushnikov aslushnikov self-assigned this Feb 19, 2021
aslushnikov added a commit to aslushnikov/playwright that referenced this issue Feb 20, 2021
Since we don't ship things like WebKitPluginAgent, we can
safely remove all the symlinks that point to the missing targets.

Fixes microsoft#5472
aslushnikov added a commit that referenced this issue Feb 20, 2021
Since we don't ship things like WebKitPluginAgent, we can
safely remove all the symlinks that point to the missing targets.

Fixes #5472
@adwam12
Copy link
Author

adwam12 commented Feb 20, 2021

@aslushnikov YES! This worked and the application packaged correctly, thank you Andrey!

@aslushnikov
Copy link
Contributor

@adwam12 great! We'll fix our WebKit distribution to remove dead links :)

aslushnikov added a commit to aslushnikov/playwright that referenced this issue Feb 20, 2021
aslushnikov added a commit to aslushnikov/playwright that referenced this issue Feb 20, 2021
aslushnikov added a commit to aslushnikov/playwright that referenced this issue Feb 22, 2021
aslushnikov added a commit that referenced this issue Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants