question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot `yarn "install` inside container because of protocal-types-generator

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: master (084cf021195dbe125d26496796f590a4300fb844)
  • Platform / OS version: Docker container running node:8
  • Node.js version: 8.16

What steps will reproduce the problem?

  1. git clone https://github.com/GoogleChrome/puppeteer.git
  2. yarn (npm fails the same way)

What is the expected result? Puppeteer is installed.

What happens instead? Installation fails when running the install script node install.js because the protocol-types-generation tries to launch chrome without the --no-sandbox argument.

Here is the output:

root@494abee07b90:/app# yarn
yarn install v1.15.2
info No lockfile found.
[1/4] Resolving packages...
warning parcel > htmlnano > uncss > jsdom > left-pad@1.3.0: use String.prototype.padStart()
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[-/4] ⢀ waiting...
[4/4] ⢀ parcel
[3/4] ⢀ puppeteer
error /app/node_modules/puppeteer: Command failed.
Exit code: 1
Command: node install.js
Arguments:
Directory: /app/node_modules/puppeteer
Output:
Chromium downloaded to /app/node_modules/puppeteer/.local-chromium/linux-641577
ERROR: Failed to download Chromium r641577! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
Error: Failed to launch chrome!
[0528/160658.820235:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

    at onClose (/app/node_modules/puppeteer/lib/Launcher.js:342:14)
    at Interface.helper.addEventListener (/app/node_modules/puppeteer/lib/Launcher.js:331:50)
    at emitNone (events.js:111:20)
    at Interface.emit (events.js:208:7)
    at Interface.close (readline.js:368:8)
    at Socket.onend (readline.js:147:10)
    at emitNone (events.js:111:20)
    at Socket.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)

The “Fail to launch Chrome” error is misleading as the .catch handler (here also catches error from function invocation in the onSuccess handler. The error is actually thrown by onSuccess > generateProtocolTypesIfNecessary > utils/protocol-types-generator/index.js; because it launches chrome without the --no-sandbox argument and this fails within a container because of root shenanigans.

note: I’ve also tried using the recommended Dockerfile, but it yields the same results.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pyrhocommented, Jun 4, 2019

@pyrho based on this your comment and your description here, do I understand it correctly that you install Puppeteer from github rather than from npm?

No puppeteer is installed via yarn (I guess yarn/npm doesn’t make a difference here but I may be wrong). You can see that it’s installed via the npm registry in the Dockerfile I pasted above. Wrong.

I think I understand what the issue is now, I’ve been using my “fork” (while #1215 is pending) referenced in my package.json like so: "puppeteer": "https://github.com/pyrho/puppeteer#27bc6663e5b72b1acb0c30c8856fdb39a56e433b", so that’s why it’s trying to generate the protocol types I guess, because I’m not pulling the prebuilt package from the NPM registry.

Sorry for the noise, and thank you for your patience and your hard work on puppeteer!

0reactions
aslushnikovcommented, Jun 4, 2019

@pyrho based on this your comment and your description here, do I understand it correctly that you install Puppeteer from github rather than from npm?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Install yarn in a docker container says missing dependency
This should be fixed by github.com/yarnpkg/yarn/pull/916, which changes the nodejs dependency from "depends" to "recommends" to allow usage of Node.js when it's ...
Read more >
Build and run a Node.js app in a container - Visual Studio Code
Create a folder for the project. Open a development command prompt in the project folder and create the project: npx express-generator npm install...
Read more >
Npm (or Yarn) Install within a Docker Container, the Right Way
Bootstrapping our project requires to install all Node dependencies we declared in our package. json file. So, we would need to execute a ......
Read more >
Using Yarn v2 workspace, Docker Compose and Visual ...
Prior to Yarn v2, it was not possible to fully Dockerize a workspace-based monorepo because workspace was implemented with symlinks, which do ...
Read more >
Writing YARN Applications - Apache Hadoop
The three main protocols for YARN application ... ContainerLaunchContext: The information defining the container in which the AM will be ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found