puppeteer: An error occurs when installing Puppeteer v3.0.0 on Cloud Build.

Steps to reproduce

Tell us about your environment:

What steps will reproduce the problem?

Please include code that reproduces the issue.

Include the following files in your project and execute the build with Cloud Build.

cloudbuild.yaml

steps:
- name: 'gcr.io/cloud-builders/npm:current'
  args: ['ci']
  dir: 'functions/autodeploy'

Cloud Build log

Step #0: gcr.io/cloud-builders/npm:current
Step #0: 
Step #0: > puppeteer@3.0.0 install /workspace/node_modules/puppeteer
Step #0: > node install.js
Step #0: 
Step #0: (node:28) ExperimentalWarning: The fs.promises API is experimental
Step #0: 
Step #0: ERROR: Failed to set up Chromium r737027! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
Step #0: { Error: ENOENT: no such file or directory, chmod '/workspace/node_modules/puppeteer/.local-chromium/linux-737027/chrome-linux/chrome'
Step #0:   -- ASYNC --
Step #0:     at BrowserFetcher.<anonymous> (/workspace/node_modules/puppeteer/lib/helper.js:105:23)
Step #0:     at fetchBinary (/workspace/node_modules/puppeteer/install.js:150:27)
Step #0:     at download (/workspace/node_modules/puppeteer/install.js:78:9)
Step #0:   errno: -2,
Step #0:   code: 'ENOENT',
Step #0:   syscall: 'chmod',
Step #0:   path:
Step #0:    '/workspace/node_modules/puppeteer/.local-chromium/linux-737027/chrome-linux/chrome' }
Step #0: npm ERR! code ELIFECYCLE
Step #0: npm ERR! errno 1
Step #0: npm ERR! puppeteer@3.0.0 install: `node install.js`
Step #0: npm ERR! Exit status 1
Step #0: npm ERR! 
Step #0: npm ERR! Failed at the puppeteer@3.0.0 install script.
Step #0: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Step #0: 
Step #0: npm ERR! A complete log of this run can be found in:
Step #0: npm ERR!     /builder/home/.npm/_logs/2020-04-16T11_43_17_460Z-debug.log
Finished Step #0
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/npm:current" failed: step exited with non-zero status: 1

What is the expected result?

Expect a successful installation.

What happens instead?

An error occurred while installing Puppeteer. There was no problem until version 2.1.1. When deploying directly to Google Cloud Functions, launch () resulted in an error.

I am not good at English, so I am using the help of Google Translate.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18

Most upvoted comments

For @alanlonglong and anyone else getting permission denied errors…

ERROR: Failed to download Chromium r722234! Set “PUPPETEER_SKIP_CHROMIUM_DOWNLOAD” env variable to skip download. Error: EACCES: permission denied, mkdir ‘/usr/bin/node/lib/node_modules/puppeteer/.local-chromium’

Using --unsafe-perm flag worked for me

sudo npm install puppeteer --unsafe-perm

SEE: https://stackoverflow.com/a/51711889/165673

Same issue on macOS @qrusadorz

Same problem on macOS when callen npm install puppeteer --save-dev (node 10.5.0 npm 6.9.0)

Downloading Chromium r737027 - 118.4 Mb [====================] 100% 0.0s 
ERROR: Failed to set up Chromium r737027! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
{ Error: ENOENT: no such file or directory, chmod '<PROJECT_DIR>/node_modules/puppeteer/.local-chromium/mac-737027/chrome-mac/Chromium.app/Contents/MacOS/Chromium'
  -- ASYNC --
    at BrowserFetcher.<anonymous> (<PROJECT_DIR>/node_modules/puppeteer/lib/helper.js:82:19)
    at fetchBinary (<PROJECT_DIR>/node_modules/puppeteer/install.js:114:27)
    at download (<PROJECT_DIR>/node_modules/puppeteer/install.js:42:9)
  errno: -2,
  code: 'ENOENT',
  syscall: 'chmod',
  path:
   '<PROJECT_DIR>/node_modules/puppeteer/.local-chromium/mac-737027/chrome-mac/Chromium.app/Contents/MacOS/Chromium' }

Edit: Works fine with node v12.8.1 (npm v6.10.2)

Same issue on Ubuntu @qrusadorz

As @pawel-buczkowski-payu mentioned. Issue with Node 10.x works fine with 12.x

Since the cloud functions still use 10, I think I won’t be able to run it in a cloud function.

hi @jackfranklin, locally on macOS

@qrusadorz Install 2.1.1 Sucess

npm i puppeteer@2.1.1 -g

puppeteer@2.1.1 install /usr/bin/node/lib/node_modules/puppeteer node install.js

ERROR: Failed to download Chromium r722234! Set “PUPPETEER_SKIP_CHROMIUM_DOWNLOAD” env variable to skip download. Error: EACCES: permission denied, mkdir ‘/usr/bin/node/lib/node_modules/puppeteer/.local-chromium’ – ASYNC – at BrowserFetcher.<anonymous> (/usr/bin/node/lib/node_modules/puppeteer/lib/helper.js:111:15) at Object.<anonymous> (/usr/bin/node/lib/node_modules/puppeteer/install.js:66:16) at Module._compile (internal/modules/cjs/loader.js:1156:30) at Object.Module._extensions…js (internal/modules/cjs/loader.js:1176:10) at Module.load (internal/modules/cjs/loader.js:1000:32) at Function.Module._load (internal/modules/cjs/loader.js:899:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) at internal/main/run_main_module.js:18:47 { errno: -13, code: ‘EACCES’, syscall: ‘mkdir’, path: ‘/usr/bin/node/lib/node_modules/puppeteer/.local-chromium’ } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! puppeteer@2.1.1 install: node install.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the puppeteer@2.1.1 install 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! /root/.npm/_logs/2020-04-22T16_13_54_357Z-debug.log

node v12.16.2 npm v 6.10.0 centos7

npm i puppeteer -g get it same