aws / aws-lambda-base-images

Apache License 2.0
648 stars 107 forks source link

Missing tar and bzip2 from public.ecr.aws/lambda/nodejs:12 image #3

Open gvasquez95 opened 3 years ago

gvasquez95 commented 3 years ago

I'd suggest these two utils should be included as part of the base image, as during an npm ci execution both were needed to properly install PhantomJS. I'm aware that this might no be a use case for all setups, but module installation is part of the basics steps of setting up a properly running NodeJS environment, so I might not be the only one to face such a scenario.

BTW, the workaround in the Dockerfile is: RUN yum install -y tar bzip2

Some evidence, just after already having install just tar:

> phantomjs-prebuilt@2.1.16 install /var/task/node_modules/phantomjs-prebuilt
> node install.js

PhantomJS not found on PATH
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Receiving...

Received 22866K total.
Extracting tar contents (via spawned process)
Error extracting archive
Phantom installation failed Error: Command failed: tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

    at ChildProcess.exithandler (child_process.js:308:12)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1022:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) {
  killed: false,
  code: 2,
  signal: null,
  cmd: 'tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2'
} Error: Command failed: tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

    at ChildProcess.exithandler (child_process.js:308:12)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1022:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)

And this is the original tar related error:

Error extracting archive
Phantom installation failed Error: spawn tar ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
    at onErrorNT (internal/child_process.js:470:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn tar',
  path: 'tar',
  spawnargs: [ 'jxf', '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2' ],
  cmd: 'tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2'
} Error: spawn tar ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
    at onErrorNT (internal/child_process.js:470:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
tslater commented 3 years ago

I'm struggling to install basic binaries without this...

DollarAkshay commented 1 year ago

Came here to comment the same. I needed to install firefox-104.0.2.tar.bz2 for my selenium project and realized tar was not available.

@gvasquez95 thank you for your solution. I was trying to use apt-get until I came across this thread