Error while loading shared libraries libnss3 so

Environment chrome-aws-lambda Version: 3.0.4 puppeteer / puppeteer-core Version: 3.0.4 OS: Mac Node.js Version: 12.x Lambda / GCF Runtime: nodejs12.x Expected Behavior Chrome should have load. Curr...

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


Closed

pmakkar93 opened this issue

Sep 30, 2020

· 22 comments

Labels

bug

Something isn’t working

invalid

This doesn’t seem right

Comments

@pmakkar93

Environment

  • chrome-aws-lambda Version: 3.0.4
  • puppeteer / puppeteer-core Version: 3.0.4
  • OS: Mac
  • Node.js Version: 12.x
  • Lambda / GCF Runtime: nodejs12.x

Expected Behavior

Chrome should have load.

Current Behavior

Error: Failed to launch the browser process!
/tmp/chromium: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md
at onClose (/var/task/node_modules/puppeteer-core/lib/Launcher.js:547:20)
at Interface. (/var/task/node_modules/puppeteer-core/lib/Launcher.js:537:65)
at Interface.emit (events.js:327:22)
at Interface.EventEmitter.emit (domain.js:483:12)
at Interface.close (readline.js:416:8)
at Socket.onend (readline.js:194:10)
at Socket.emit (events.js:327:22)
at Socket.EventEmitter.emit (domain.js:483:12)
at endReadableNT (_stream_readable.js:1220:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)

Steps to Reproduce

const chromium = require('chrome-aws-lambda');
const puppeteer = require('puppeteer-core');

  async convertToPdf(request) {
    try {
      console.log('Starting puppeteer browser.');

      const browser = await chromium.puppeteer.launch({
        args: chromium.args,
        defaultViewport: chromium.defaultViewport,
        executablePath: await chromium.executablePath,
        headless: true,
        ignoreHTTPSErrors: true
      });

      console.log('Puppeteer launched: ' + !!browser);


      if (request.sections.length > 75) {
        throw new Error('Only 75 report sections are allowed');
      }

      let pdfs = await Promise.all(_.map(request.sections, async (section, $index) => {
        if (section.s3Pdf) {
          let s3Response = await s3.getObject({
            Bucket: section.s3Pdf.bucket,
            Key: section.s3Pdf.key
          }).promise();

          console.log(`PDF ${$index} retrieved successfully`);
          return s3Response.Body;
        }
        const page = await browser.newPage();

        page.setViewport(request.viewPort || {
          width: 1024,
          height: 600
        });

        section.options = section.options || {};

        console.log(`Loading section ${$index}...`);
        await page.setContent(this.fromBase64(section.html), {waitUntil: ['networkidle0']});
        console.log(`Section ${$index} Load complete. Converting html to pdf using puppeteer. Options: ${JSON.stringify(section.options)}`);

        let body = await page.pdf(_.assign({format: 'letter'}, section.options));

        console.log(`PDF ${$index} created successfully`);
        page.close();
        return body;
      }));

Previously my code was running properly on nodejs8.10 supported AWS Lambda function but after forcefully upgrade to nodejs12.x, my code starts to throw this error. I tried upgrading chrome-aws-lambda and puppeteer-core version to 2.1.1 and even the latest 5.3.1 but no luck on resolving the issue.

@pmakkar93
pmakkar93

changed the title
[BUG]

[BUG] Failed to launch the browser process: error while loading shared libraries: libnss3.so: cannot open shared object file

Sep 30, 2020

@alixaxel

@pmakkar93 With Node 12 the Lambda environment needs provisioning of additional shared libraries for Chromium to work, the earliest version that would work on this environment is precisely 3.0.4 (I advise you to upgrade to the latest 5.3.x though).

I think the issue that you’re facing might be caused by a warm Lambda that is still keeping the files under /tmp and thus preventing these libraries from being provisioned. Please try a brand new deployment with 3.0.4 or any version since.


Edit: I just noticed that you’re trying this on Mac? If so please check this wiki page.

@whoisjuan

@alixaxel Any potential workaround for this? I also have this exact same problem but since 2.0.0, Puppeteer introduced a change that broke clipping beyond the viewport and this was needed to curve a lot of issues with the screenshotting mechanism.

@jmdiego

I’m getting this same issue with:

  • node 12
  • chrome-aws-lambda 5.3.1
  • puppeter-core 5.3.1

@yoshiokimoto

It’s not the exactly same case but I’ve seen same issue to initialize the browser object, missing libnss3.so. In my case it only happens when I run the lambda with aws-sam-cli in debug mode.
Actually I don’t see the issue if I run the lambda at my local with normal mode (i.e. run with sam local invoke), but in debug mode (sam local invoke -d 5858) I can see the error message Failed to launch the browser process!n/tmp/chromium: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory.

Actually I could notice that the environment variable AWS_EXECUTION_ENV is not defined in local lambda container if I run in debug mode, it’s there in normal mode on the other hand.
And when I set that variable in template.yaml file (which contains the definition of serverless application in aws sam), then the error was gone.
My experience is only in aws sam, but hope this can be a clue to resolve someone’s trouble.
My environment is:

  • Mac Catalina
  • chrome-aws-lambda: 5.3.1
  • puppeteer-core: 5.3.1
  • Node: 12.x

Also, I know there are few lines which use AWS_EXECUTION_ENV as a switch to modify env variables like https://github.com/alixaxel/chrome-aws-lambda/blob/master/source/index.js#L6.
It can be better to have more robust check routine since I’ve seen it’s not always defined.

@Sandstedt

I get the same error, but not related to AWS, but Linux on a Windows 10 machine using WSL 2 (Ubuntu 20.04.1 LTS) and Puppetter: 5.5.0:
ChromeHeadless stderr: /home/sandstedt/_open-source/mojs/node_modules/puppeteer/.local-chromium/linux-818858/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

Solved it by installing all missing dependencies listed here: Puppeteer Troubleshooting

keisenb, IgorKurkov, Pol528, chikul, batjko, st-patrick, RyanHow, lucashenriquesilvahorta23, ca0v, 0xJem, and 3 more reacted with thumbs up emoji
IgorKurkov, chikul, and RyanHow reacted with hooray emoji
keisenb, aaronamm, IgorKurkov, scrappy9, chikul, and RyanHow reacted with heart emoji
keisenb, IgorKurkov, chikul, and RyanHow reacted with rocket emoji

@citak

This may be helpful to some, to check which libs are missing just do cd /project_folder/node_modules/puppeteer/.local-chromium/linux-version/chrome-linux/ ldd chrome | grep not make sure to change the folders to your own folders, hope this helps.

@darkphoenixff4

I just pushed up my code to AWS Lambda, and I’m getting the exact same error. New deployment (actually never been deployed before), NodeJs12, using the shelfio layer.

Also got the same error following the instructions in the Lambda Layers option. The resulting zip file, pushed up to AWS Lambda, triggers the same error, missing libnss3.so .

@damisparks

Here is how I fixed mine.

  • First, I ran an update.
  • Move to the chromium directory.
cd /project_folder/node_modules/puppeteer/.local-chromium/[linux-579032]/[chrome-linux]

but replace the bracketed directories with the directories available in your node_modules folder. There you should find the local installation of chrome and from there you ran the next command.

  • Next, run this

on a Linux machine to check which dependencies are missing.
Read more here Chrome headless doesn’t launch on UNIX

  • Run this to install the missing libraries or packages.
sudo apt-get install libpangocairo-1.0-0 libx11-xcb1 libxcomposite1 libxcursor1 libxdamage1 libxi6 libxtst6 libnss3 libcups2 libxss1 libxrandr2 libgconf2-4 libasound2 libatk1.0-0 libgtk-3-0
sudo apt-get install -y libgbm-dev
  • Run this again to check if the missing packages are installed
    ldd chrome | grep not this time nothing is shown on the terminal, so you should be good.
  • In your JS code, add this
const browser = await puppeteer.launch({
    headless: true,
    args: ['--no-sandbox'] });

That is it. You are good to go. Hopefully, this helps someone. 😄

GDur, jonathanpmartins, ryno1234, ifenglin, mattrussell2, Abdelmonem-Mohamed, mifi, SoleeChoi, flagg2, f1rstsurf, and 39 more reacted with thumbs up emoji
GDur, jonathanpmartins, mattrussell2, SoleeChoi, f1rstsurf, YannLeBihan, pawelhertman, cstodor, phbernard, TheBotlyNoob, and 4 more reacted with hooray emoji
hadifarnoud, GDur, shamin, jonathanpmartins, mattrussell2, SoleeChoi, f1rstsurf, hrvojej, AdminAnticaptcha, pawelhertman, and 16 more reacted with heart emoji
GDur, jonathanpmartins, mattrussell2, SoleeChoi, f1rstsurf, MedinaAJ, pawelhertman, alexTitakoff, mifi, cstodor, and 5 more reacted with rocket emoji

@markb-trustifi

@damisparks I have the same problem of running Puppeteer in AWS Lambda env. Lambda cannot run sudo apt-get install and not even yum install. In addition, all volumes except /tmp are read-only so, the fix provided above is irrelevant. Is there any solution for this case?

bluefire2121, harryhan24, aldenquimby, dasheck0, jl4386, mracette, FunctionalWorm, odellcraig, RyanSacha, KevinVR, and 5 more reacted with thumbs up emoji

@alixaxel

@markb-trustifi This issue is now a bit all over the place to be able to understand it and follow up on it properly.

I suggest you create a new issue with code to repro it, if that’s not possible try passing dumpio: true to launch().

Chances are, that if there’s a missing shared library, it will be logged there.
If I know which library it is, I can try to provision it with this package.

@sromano88-svc

I had this error and the fix was to set lambda memory to 512 mb.

@looeee

sudo apt-get install libpangocairo-1.0-0 libx11-xcb1 libxcomposite1 libxcursor1 libxdamage1 libxi6 libxtst6 libnss3 libcups2 libxss1 libxrandr2 libgconf2-4 libasound2 libatk1.0-0 libgtk-3-0

This resulted in an error:

Package libgconf2-4 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'libgconf2-4' has no installation candidate

All the other packages installed correctly. This fails:

sudo apt-get install libgconf2-4 

However, I was able to install it by using apt instead of apt-get:

sudo apt install libgconf2-4 

Once I did that puppeteer works correctly.

@ca0v

There was a long list of dependencies, so I tried this and it worked:

sudo apt install chromium-browser

I am using Ubuntu WSL on Windows 10.

@KevinVR

Has anybody found a solution to this for AWS Lambda? Obviously the lib can’t be installed manually to the machine.

@skilbjo

Anecdotally, I am seeing this only on the node16 runtime. When I use the node14 runtime it works fine, and when I bump to node16 I get the

Failed to launch the browser process: error while loading shared libraries: libnss3.so

error

shohei-ihaya, anurag-roy, tomoima525, yzhe819, imadx, tinglei8, vmariano, hinagithub, dasheck0, hassanAdamineJad, and 3 more reacted with thumbs up emoji

@tomoima525

Same here. I was trying to attempt upgrading lambda version after this update aws/aws-lambda-base-images#14 but I got the error above. It was working with v14 with the workaround mentioned in #268

@tomoima525

@skilbjo

@Sparticuz

That layer is currently out of date. You can build your own up to date layer using my fork though

@johntravolta1

I didn’t noticed that my serverless.yml was on runtime: nodejs16.x. When I changed it to nodejs14.x I was able to run withou this error on aws lambda.
Error: «/tmp/chromium: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory»
Fix: Changed serverless.yml to
provider:
name: aws
runtime: nodejs14.x
and redeployed

@Sparticuz

@johntravolta1 This repo’s version only supports node14, not node16. You can support node16 by running the patch found in #274

@pencilcheck

version 6.0.0 + node14 worked for me and under limit

Labels

bug

Something isn’t working

invalid

This doesn’t seem right

Содержание

  1. Ошибка error while loading shared libraries
  2. Что означает error while loading shared libraries?
  3. Как исправить ошибку?
  4. 1. Библиотека не установлена
  5. 2. Библиотека находится не в том каталоге
  6. 3. Неверная версия библиотеки
  7. Выводы
  8. How To Solve «cannot open shared object file» Error in Ubuntu-based Linux Distributions
  9. Fix ing ‘cannot open shared object file: No such file or directory’ error
  10. What are shared object files? How does the above command fixes the issue?
  11. Alternate method to fix ‘cannot open shared object file’ error
  12. Nothing works, what now?
  13. Did it work for you?
  14. [BUG] Failed to launch the browser process: error while loading shared libraries: libnss3.so: cannot open shared object file #164
  15. Comments
  16. Environment
  17. Expected Behavior
  18. Current Behavior
  19. Steps to Reproduce

Новые и опытные пользователи Linux могут сталкиваться с ошибкой error loading shared libraries во время запуска программ, также с ней могут сталкиваться программисты и все желающие компилировать программное обеспечение в своей системе. Эта ошибка в дословном переводе означает что возникла проблема во время загрузки общей библиотеки. О том что такое библиотеки и зачем они нужны вы можете узнать из статьи библиотеки Linux.

В этой же статье мы рассмотрим что значит ошибка error while loading shared libraries более подробно, а главное, как ее решить.

Даже если вы не компилируете свои программы, то вы можете увидеть ошибку error while loading shared libraries: имя_библиотеки: cannot open shared object file: No such file or directory достаточно часто во время установки новых программ не через пакетный менеджер или программ, предназначенных для другого дистрибутива. Как я уже говорил, она возникает потому, что система не может найти библиотеку.

А вот почему ее нельзя найти и загрузить, это уже интересно. Этому может быть несколько причин:

  • Библиотека не установлена в системе;
  • Библиотека установлена, но неизвестно куда;
  • Библиотека установлена правильно, но имеет не ту версию.

При решении проблемы мы будем руководствоваться именно этими причинами и пытаться их решить.

Как исправить ошибку?

1. Библиотека не установлена

Первый вариант, тут все понятно, библиотеки просто нет в системе, поэтому мы и получаем такую ошибку. Верный способ ее решения — просто найти пакет библиотеки с помощью пакетного менеджера и установить ее. Обычно, пакеты с библиотеками называются так же, как и сами библиотеки с префиксом lib.

Например, если нам не хватает библиотеки libfuse2.so, то мы можем найти ее в Ubuntu такой командой:

sudo apt search libfuse2

Затем осталось только установить ее:

sudo apt install libfuse2

Если перед вами стоит задача собрать программу из исходников, то вам понадобится не только установить саму библиотеку, но и заголовочные файлы для нее:

sudo apt install libfuse-dev

И так для любой библиотеки. Но это не всегда помогает.

2. Библиотека находится не в том каталоге

Бывает что библиотека установлена, мы установили ее или она поставлялась вместе с программой, но ошибка как была, так и есть. Причиной этому может быть то, что загрузчик Linux не может найти библиотеку.

Поиск библиотек выполняется по всех папках, которые указаны в конфигурационных файлах /etc/ld.conf.d/. По умолчанию, это такие каталоги, как /usr/lib, /lib, /usr/lib64, /lib64. Если библиотека установлена в другой каталог, то, возможно, это и есть причина проблемы.

Вы можете посмотреть какие библиотеки сейчас доступны загрузчику с помощью команды:

Найти, где находится ваша библиотека можно с помощью команды locate. Например, нас интересует библиотека librtfreader.so:

Теперь мы знаем, что она находится по адресу /opt/kingsoft/wps-office/office6/. А значит, для работы программы необходимо сделать чтобы загрузчик библиотек ее видел. Для этого можно добавить путь в один из файлов /etc/ld.so.conf.d/ или же в переменную LD_LIBRARY_PATH:

Опять же, так вы можете поставить с любой библиотекой, которая взывает ошибку. Еще один более простой метод — это просто создать символическую ссылку на нужную библиотеку в правильной папке:

ln -s /opt/kingsoft/wps-office/office6/librtfreader.so /usr/lib/librtfreader.so

3. Неверная версия библиотеки

Эта причина ошибки довольно часто встречается при использовании программ не для вашего дистрибутива. Каждая библиотека имеет дополнительную версию, так называемую ревизию, которая записывается после расширения .so. Например, libav.so.1. Так вот, номер версии меняется всякий раз, когда в библиотеку вносятся какие-либо исправления.

Часто возникает ситуация, когда в одном дистрибутиве программа собирается с зависимостью от библиотеки, например, libc.so.1, а в другом есть только libc.so.2. Отличия в большинстве случаев здесь небольшие и программа могла бы работать на второй версии библиотеки. Поэтому мы можем просто создать символическую ссылку на нее.

Например, библиотеки libusb-1.0.so.1 нет. Но зато есть libusb-1.0.so.0.1, и мы можем ее использовать:

Для этого просто создаем символическую ссылку на библиотеку:

sudo ln -s /usr/lib/libusb-1.0.so.0.1 /usr/lib/libusb-1.0.so.1

В большинстве случаев программа не заметит подмены и будет работать, как и ожидалось. Также для решения этой проблемы можно попытаться найти нужную версию библиотеки в интернете для своей архитектуры и поместить ее в папку /usr/lib/ или /usr/lib64/. Но после этого желательно обновить кэш:

Выводы

В этой статье мы рассмотрели почему возникает ошибка Error while loading shared libraries, а также как ее решить. В большинстве случаев проблема решается довольно просто и вы получите работоспособную программу. Надеюсь, эта информация была полезной для вас.

Источник

There is a list of common errors I often see in Ubuntu. There is problem with merge list, then there is BADSIG error, and a number of common Ubuntu update errors.

One of such common errors which I often see while installing a program from its source code is error while loading shared libraries. The full error generally looks like this:

error while loading shared libraries:
cannot open shared object file: No such file or directory

For example, I was trying to use FreeRADIUS server and it showed me this error:

The reason behind this error is that the libraries of the program have been installed in a place where dynamic linker cannot find it.

Let me show you how you can go about fixing this issue.

One quick way to fix this “error while loading shared libraries” automatically is to use ldconfig.

All you need to do is to open terminal (Ctrl+Alt+T) and type the following command:

This one liner should solve the problem in most cases. However, if it doesn’t, I have discussed another method to handle this error. But before that, let me tell you what does the above command do.

What are shared object files? How does the above command fixes the issue?

You see, in C/C++, a .so (shared object) is a compiled library file. It is called shared object because this library file can be shared by several programs. These generated libraries are usually located in /lib or /usr/lib directories.

Now if you wonder how did this tiny command fixed this problem, you should read the man page of ldconfig which says:

ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/lib and /usr/lib). The cache is used by the run-time linker, ld.so or ld-linux.so. ldconfig checks the header and filenames of the libraries it encounters when determining which versions should have their links updated.

I hope this quick fix helps you in eliminating the nasty error while loading shared libraries message in Ubuntu and other Linux.

If not, you can do some investigation and try to fix the issue the way it is mentioned in the next section.

The above discussed method fixes the issue if the library in question is available in your system. But that may not always be the case.

If you do not have the program installed on your system, you won’t have its library file. The ldconfig cannot do anything if there is no library file in the first place.

So, the alternate method is to install the required program and it should create the library automatically.

Let me show it to you by an example. Let’s say you see this error:

The problem is with libgobject version 2.0. The version number is important because some programs depend on a specific version of the library and if they don’t find, they complain about it.

Now, apt provides the search option that can be used for searching a package and knowing its version before installing it.

Now, this librust-gobject-sys-dev package could be what you need if you know that you were trying to run a Rust program. But what if it was a Python program you were running that complained about it?

You can widen your search by removing the lib from the package name while searching. The lib signifies library and libraries may be provided by a generic package that could be named gobject-xyz.

It would be a good idea to search for the string in the names of the package (instead of description) to get more concise results.

In the above truncated output, you’ll have to see if the package is related to the original program you were trying to run. You must also check the version of the library provided.

Once you have identified the correct package, install it like this:

Once installed, you may run the ldconfig command again to update the cache:

This method requires some effort on your end but this is how the dependencies are handled.

Nothing works, what now?

If you are unfortunate enough, the above methods might not work for you. What can you do?

First, keep in mind that the shared libraries may be used from other packages in some cases. If you were trying to run XYZ program and ABC program installs the correct version of the shared library, it may (or may not) work for you. You can give it a hit and trial.

Second, if you are trying to run a program which is too old or too new, it may require a library version which is not available for your Linux distribution.

What you may do is to check if you can use some other version of the program. For example, using Eclipse version 3 instead of version 4. This may help your case.

The other way would be to check the developers website or forums and see if you can manually install the correct version of the library from its source code. That requires a lot of effort (in 2020) but you don’t have a lot of options.

Did it work for you?

I hope I have make things a bit more clear for you. Did you manage to fix the issue of shared libraries in your system? If you have questions, suggestions, feel free to drop a comment. Ciao 🙂

Источник

[BUG] Failed to launch the browser process: error while loading shared libraries: libnss3.so: cannot open shared object file #164

Environment

  • chrome-aws-lambda Version: 3.0.4
  • puppeteer / puppeteer-core Version: 3.0.4
  • OS: Mac
  • Node.js Version: 12.x
  • Lambda / GCF Runtime: nodejs12.x

Expected Behavior

Chrome should have load.

Current Behavior

Error: Failed to launch the browser process!
/tmp/chromium: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md
at onClose (/var/task/node_modules/puppeteer-core/lib/Launcher.js:547:20)
at Interface. (/var/task/node_modules/puppeteer-core/lib/Launcher.js:537:65)
at Interface.emit (events.js:327:22)
at Interface.EventEmitter.emit (domain.js:483:12)
at Interface.close (readline.js:416:8)
at Socket.onend (readline.js:194:10)
at Socket.emit (events.js:327:22)
at Socket.EventEmitter.emit (domain.js:483:12)
at endReadableNT (_stream_readable.js:1220:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)

Steps to Reproduce

Previously my code was running properly on nodejs8.10 supported AWS Lambda function but after forcefully upgrade to nodejs12.x, my code starts to throw this error. I tried upgrading chrome-aws-lambda and puppeteer-core version to 2.1.1 and even the latest 5.3.1 but no luck on resolving the issue.

The text was updated successfully, but these errors were encountered:

@pmakkar93 With Node 12 the Lambda environment needs provisioning of additional shared libraries for Chromium to work, the earliest version that would work on this environment is precisely 3.0.4 (I advise you to upgrade to the latest 5.3.x though).

I think the issue that you’re facing might be caused by a warm Lambda that is still keeping the files under /tmp and thus preventing these libraries from being provisioned. Please try a brand new deployment with 3.0.4 or any version since.

Edit: I just noticed that you’re trying this on Mac? If so please check this wiki page.

@alixaxel Any potential workaround for this? I also have this exact same problem but since 2.0.0, Puppeteer introduced a change that broke clipping beyond the viewport and this was needed to curve a lot of issues with the screenshotting mechanism.

I’m getting this same issue with:

  • node 12
  • chrome-aws-lambda 5.3.1
  • puppeter-core 5.3.1

It’s not the exactly same case but I’ve seen same issue to initialize the browser object, missing libnss3.so. In my case it only happens when I run the lambda with aws-sam-cli in debug mode.
Actually I don’t see the issue if I run the lambda at my local with normal mode (i.e. run with sam local invoke ), but in debug mode ( sam local invoke -d 5858 ) I can see the error message Failed to launch the browser process!n/tmp/chromium: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory .

Actually I could notice that the environment variable AWS_EXECUTION_ENV is not defined in local lambda container if I run in debug mode, it’s there in normal mode on the other hand.
And when I set that variable in template.yaml file (which contains the definition of serverless application in aws sam), then the error was gone.
My experience is only in aws sam, but hope this can be a clue to resolve someone’s trouble.
My environment is:

  • Mac Catalina
  • chrome-aws-lambda: 5.3.1
  • puppeteer-core: 5.3.1
  • Node: 12.x

Also, I know there are few lines which use AWS_EXECUTION_ENV as a switch to modify env variables like https://github.com/alixaxel/chrome-aws-lambda/blob/master/source/index.js#L6.
It can be better to have more robust check routine since I’ve seen it’s not always defined.

I get the same error, but not related to AWS, but Linux on a Windows 10 machine using WSL 2 (Ubuntu 20.04.1 LTS) and Puppetter: 5.5.0:
ChromeHeadless stderr: /home/sandstedt/_open-source/mojs/node_modules/puppeteer/.local-chromium/linux-818858/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

Solved it by installing all missing dependencies listed here: Puppeteer Troubleshooting

This may be helpful to some, to check which libs are missing just do cd /project_folder/node_modules/puppeteer/.local-chromium/linux-version/chrome-linux/ ldd chrome | grep not make sure to change the folders to your own folders, hope this helps.

I just pushed up my code to AWS Lambda, and I’m getting the exact same error. New deployment (actually never been deployed before), NodeJs12, using the shelfio layer.

Also got the same error following the instructions in the Lambda Layers option. The resulting zip file, pushed up to AWS Lambda, triggers the same error, missing libnss3.so .

Here is how I fixed mine.

  • First, I ran an update.
  • Move to the chromium directory.

but replace the bracketed directories with the directories available in your node_modules folder. There you should find the local installation of chrome and from there you ran the next command.

  • Next, run this

on a Linux machine to check which dependencies are missing.
Read more here Chrome headless doesn’t launch on UNIX

  • Run this to install the missing libraries or packages.
  • Run this again to check if the missing packages are installed
    ldd chrome | grep not this time nothing is shown on the terminal, so you should be good.
  • In your JS code, add this

That is it. You are good to go. Hopefully, this helps someone. 😄

Источник

It’s an Amazon RHEL server and I deleted the libnss by running

rpm --nodeps -e nss-*;
package-cleanup --cleandupes;

Now when I run rpm I get an error:

rpm: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

And the same error with yum:

libnss3.so: cannot open shared object file: No such file or directory

How can I reinstall libnss now?

Stephen Kitt's user avatar

Stephen Kitt

388k51 gold badges996 silver badges1095 bronze badges

asked Mar 19, 2018 at 23:26

Zack's user avatar

8

You’ll need to download the necessary packages manually, and extract them using rpm2cpio and cpio (which don’t need libnss3). Go to the package browser (using your subscription information) and look for nss, then follow the links to download the appropriate version for your RHEL installation. On the server, “install” it by extracting it as follows, as root:

cd /
rpm2cpio /path/to/nss-....rpm | cpio -idmv

(replacing the path as appropriate, and the ... with whatever version you have).

This will extract the libraries, and should allow you to use rpm and yum again. You should then re-install the nss package properly using yum, along with any other missing dependencies.

Please remember not to use --no-deps in future!

answered Mar 20, 2018 at 9:34

Stephen Kitt's user avatar

Stephen KittStephen Kitt

388k51 gold badges996 silver badges1095 bronze badges

0

The answer above has an issue…
Depending on the Fedora/RHEL version rpm2cpio may depend on libnss3 as well.
You will need another operating system to extract the cpio file from the RPM package (Peazip can do it)

answered Feb 8, 2021 at 21:43

BlackScout's user avatar

Понравилась статья? Поделить с друзьями:
  • Error while loading shared libraries libncurses so 5
  • Error while loading shared libraries libmysqlclient so 20
  • Error while loading shared libraries libmpc so 3
  • Error while loading shared libraries libidn so 11
  • Error while loading shared libraries libglu so 1