Puppeteer not working on AWS but running locally
Aws | Puppeteer not working on AWS but is running locally. - /root/retwiter/node_modules/puppeteer/.local-chromium/linux-800071/chrome-linux/chrome: error while loading shared libraries: libatk-1.0.so.0: cannot open shared object file: No such file or directory
Original answer link StackOverflow: Here answer
If you have a problem with this /root/retwiter/node_modules/puppeteer/.local-chromium/linux-800071/chrome-linux/chrome: error while loading shared libraries: libatk-1.0.so.0: cannot open shared object file: No such file or directory
You can add AWS Elastic Beanstalk configuration files (.ebextensions
) to your web application's source code to configure your environment and customize the AWS resources that it contains.
In our case, if we don't enable EPEL and if we continue installing Chromium as part of the npm install, Puppeteer cannot launch Chromium due to the unavailability of libatk-1.0.so.0
.
Hotfix
Add the following to your app root
- Create a
.npmrc
file. - Add the following to your
.npmrc
file:unsafe-perm=true
.npmrc
file defines how npm should behave when running commands. Settingunsafe-perm
totrue
suppress the UID/GID switching when running package scripts. Set the unsafe-perm flag to run scripts with root privileges. Source unsafe-perm - Create a
.ebextensions
folder. - Inside
.ebextensions
folder, create a01_enableEPEL.config
file and add the following.commands: 01_enableEPEL: command: sudo amazon-linux-extras install epel -y
- Inside
.ebextensions
folder, create a02_installEPELPackages.config
file and add the following.packages: yum: chromium: []
You can view the same guide on GitHub @
https://github.com/amarinediary/Marionette