2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PuppeteerをCentOSで動かす(sandbox)

Posted at

概要

PuppeteerをCentOSで動かすための備忘録です。
Vagrantを使って構築します。

環境

MacOS Mojave
Vagrant 2.2.3
CentOS 7

コマンド

  • Chrome用の依存をインストール
$ yum -y install pango libXcomposite libXcursor libXdamage libXext libXi libXtst cups-libs libXScrnSaver libXrandr GConf2 alsa-lib atk gtk3 ipa-gothic-fonts xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc
  • nssをアップデートする
$ yum -y update nss
  • Node.js, YarnとPuppeteerのインストール
$ yum -y install https://rpm.nodesource.com/pub_12.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm
$ yum -y install nodejs
$ curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo
$ rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg
$ yum install -y yarn

$ cd your project
$ yarn add puppeteer    // or install it from package.json

No usable sandbox!対応

$ cd node_modules/puppeteer/.local-chromium/linux-686378/chrome-linux/
$ chown root:root chrome_sandbox
$ chmod 4755 chrome_sandbox

$ cp -p chrome_sandbox /usr/local/sbin/chrome-devel-sandbox
$ chown root:root /usr/local/sbin/chrome-devel-sandbox
$ chmod 4755 /usr/local/sbin/chrome-devel-sandbox

$ echo 'export CHROME_DEVEL_SANDBOX=/usr/local/sbin/chrome-devel-sandbox' >> /home/vagrant/.bashrc

これで--no-sandboxが要らないはず。

参考

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?