Error installing MathJax to AWS Lambda

Hi everyone,

Just curious if anyone has tried to install the PB-Mathjax to AWS Lambda in a while. I’m in over my head, but I thought I had done everything I needed to do:

  • I signed up for AWS,
  • Created a new user with the proper IAM permissions (named mine mathjax),
  • Configured the AWS CloudShell command line interface,
  • Copied the files from the github repo,
  • Went to the newly created pb-mathjax dir
  • ran the suggested command.

claudia create --handler lambda.handler --deploy-proxy-api --region us-east-2 --timeout 15 --memory 256 --profile mathjax

Here’s the error output I received:

> sharp@0.22.1 install /tmp/txNfi6/pb-mathjax-0.0.0-mBmKI3/package/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Using cached /home/cloudshell-user/.npm/_libvips/libvips-8.7.4-linux-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=14.16.1 runtime=node arch=x64 libc= platform=linux)
make: Entering directory `/tmp/txNfi6/pb-mathjax-0.0.0-mBmKI3/package/node_modules/sharp/build'
  TOUCH Release/obj.target/libvips-cpp.stamp
  CXX(target) Release/obj.target/sharp/src/common.o
make: g++: Command not found
make: *** [Release/obj.target/sharp/src/common.o] Error 127
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Linux 4.14.243-185.433.amzn2.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/txNfi6/pb-mathjax-0.0.0-mBmKI3/package/node_modules/sharp
gyp ERR! node -v v14.16.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
make: Leaving directory `/tmp/txNfi6/pb-mathjax-0.0.0-mBmKI3/package/node_modules/sharp/build'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.22.1 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sharp@0.22.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!     /home/cloudshell-user/.npm/_logs/2021-09-15T19_11_55_838Z-debug.log
npm install -q --no-audit --production failed.

Can anyone help me read the error message here?