Skip to content
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

Error: gl returned null (missing dependencies) #33

Open
maerics opened this issue Apr 30, 2020 · 52 comments
Open

Error: gl returned null (missing dependencies) #33

maerics opened this issue Apr 30, 2020 · 52 comments

Comments

@maerics
Copy link

maerics commented Apr 30, 2020

While attempting to run the "kenBurns" example in a Debian docker image (using a node:14-stretch base image) I get the following error:

640x640 25fps
Error: gl returned null, this probably means that some dependencies are not installed. See README.
    at module.exports (/usr/local/lib/node_modules/editly/glTransitions.js:12:11)
    at module.exports (/usr/local/lib/node_modules/editly/index.js:265:36)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async /usr/local/lib/node_modules/editly/cli.js:124:3

For reference, here's the Dockerfile I'm using:

FROM node:14-stretch

RUN apt-get -qq update \
  && apt-get -qq install \
    build-essential \
    libcairo2-dev \
    libpango1.0-dev \
    libjpeg-dev \
    libgif-dev \
    librsvg2-dev \
    libxi-dev \
    libglu1-mesa-dev \
    libglew-dev \
    pkg-config \
    python2.7 \
    python-pip \
    ffmpeg

RUN mkdir -p /opt/node \
  && cd /opt/node \
  && npm install --global --unsafe-perm editly
@chapmanjacobd
Copy link
Contributor

maybe you need xvfb

@maerics
Copy link
Author

maerics commented Apr 30, 2020

No change after installing that package, still seeing the same error

@chapmanjacobd
Copy link
Contributor

@maerics
Copy link
Author

maerics commented Apr 30, 2020

Looks like any sort of docker install might be complicated! 😛

@mifi
Copy link
Owner

mifi commented May 1, 2020

If you find a way to do it, then it would be nice if u put together a list of working instructions (or a link), then we can put it in the readme 👍

@Stefan-Hanke
Copy link

Merely installing xvfb just... installs it. However it is not running. I've used the instructions found here

xvfb-run -s "-ac -screen 0 1280x1024x24" <node program>

Using that command results in e.g. xvfb-run -s "-ac -screen 0 1280x1024x24" editly --json kenBurns.json5 which now complains about assets not found.

BTW I find it unfortunate that there are no sample assets. Makes it harder to play around with it.

@maerics
Copy link
Author

maerics commented May 1, 2020

@Stefan-Hanke great find, that command prefix does the trick! I'll submit a PR with the dockerfile and instructions in the readme. If we could get those assets in this repo then the examples could just work (tm) out of the box...

@mifi
Copy link
Owner

mifi commented May 2, 2020

Good job!

I don't want to include the sample assets in this repository because they are quite huge and I don't want everyone who downloads the repo to have to download hundreds of megabytes. But I'm thinking about putting them in a separate github repo and then having a download script from here.

@over9001
Copy link

I'm thinking about putting them in a separate github repo and then having a download script from here
Yes please!

@MDrooker
Copy link

MDrooker commented Aug 7, 2020

I did get further along with this Docker File...But now its failing when FFMPEG tries to write out to the temp dir-
Hope this helps someone

FROM node:14.7
# FROM nikolaik/python-nodejs:latest
RUN apt-get update && apt-get install -y \
    libcairo2-dev \
    libpango1.0-dev \
    libjpeg-dev \
    libgif-dev \
    librsvg2-dev \
    libxi-dev \
    libglu1-mesa-dev \
    libglew-dev \
    python2.7 \
    python-pip \
    ffmpeg \
    xvfb
# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# #
# ## Install app dependencies
COPY package.json /usr/src/app/

RUN npm install
ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 /usr/bin/dumb-init
RUN chmod 0777 /usr/bin/dumb-init

# Bundle app source
COPY . /usr/src/app

ENTRYPOINT ["/usr/bin/dumb-init", "--", "xvfb-run", "-s", "-ac -screen 0 1280x1024x24"]
CMD [ "node", "source/startup.js" ]

@glebteterin
Copy link

@MDrooker your configuration works for me just fine

@MDrooker
Copy link

Yea...Mine is still tossing errors on creating the asset.

@srameshr
Copy link

Using xvfb-run -s '-screen 0 1024x768x24 -ac +extension GLX +render -noreset' node index.js fails with an out of memory error if the video is 720P in width.

@dinesh-rawat-dev
Copy link

640x640 25fps
(node:19147) UnhandledPromiseRejectionWarning: Error: gl returned null, this probably means that some dependencies are not installed. See README.
    at module.exports (/home/ubuntu/backend/node_modules/editly/glTransitions.js:12:11)
    at module.exports (/home/ubuntu/backend/node_modules/editly/index.js:347:36)
(node:19147) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:19147) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I am also struglling this issue in ubuntu 18

@srameshr
Copy link

@Dinesh-Rawat You have to install all the linux dependencies.

@dinesh-rawat-dev
Copy link

@srameshr Can you please redirect me to some helpful article? Finding no solution for this anywhere

@srameshr
Copy link

#72 (comment)

@dinesh-rawat-dev
Copy link

For MacOS that is all I did,

brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools

@dinesh-rawat-dev
Copy link

@srameshr Most of the packages you shared are not found for ubuntu 18.

@dinesh-rawat-dev
Copy link

I tried to debug it a little bit and found:

https://github.com/mifi/editly/blob/master/glTransitions.js#L9

is not returning anything.

@srameshr
Copy link

@Dinesh-Rawat I run on a mac and all you need is ffmpeg and ffprobe. For linux you need more dependencies.

@mifi mifi changed the title Error: gl returned null in node:14-stretch (Debian GNU/Linux) docker image Error: gl returned null (missing dependencies) Oct 5, 2020
@armandolio
Copy link

I tried to debug it a little bit and found:

https://github.com/mifi/editly/blob/master/glTransitions.js#L9

is not returning anything.

I'm trying to run on my mac, same issue

gl returned null, this probably means that some dependencies are not installed.

@mifi
Copy link
Owner

mifi commented Nov 13, 2020

which node.js version are you running? and macos version.
See https://github.com/stackgl/headless-gl#supported-platforms-and-nodejs-versions

@armandolio
Copy link

Node.js v12.13.0
macOS Mojave 10.14.4

@mifi
Copy link
Owner

mifi commented Nov 13, 2020

same problem with newest node.js 12?

@armandolio
Copy link

yes..

armando$ editly --fast kenBurns.json5 ffmpeg version 4.3.1 ffprobe version 4.3.1 250x250 15fps Caught error Error: gl returned null, this probably means that some dependencies are not installed. See README. at module.exports (/usr/local/lib/node_modules/editly/glTransitions.js:12:11) at Editly (/usr/local/lib/node_modules/editly/index.js:170:60) at async /usr/local/lib/node_modules/editly/cli.js:133:3

@mifi
Copy link
Owner

mifi commented Nov 13, 2020

which node version are you running now?

@armandolio
Copy link

12.13.0

@mifi
Copy link
Owner

mifi commented Nov 13, 2020

that is not the newest version...

@armandolio
Copy link

I'm running node v15.2.0, throw an error:

`node:internal/modules/cjs/loader:1161
return process.dlopen(module, path.toNamespacedPath(filename));
^

Error: The module '/usr/local/lib/node_modules/editly/node_modules/canvas/build/Release/canvas.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 88. Please try re-compiling or re-installing`

@mifi
Copy link
Owner

mifi commented Nov 13, 2020

google can help you with this

@patcon
Copy link
Contributor

patcon commented Dec 8, 2020

Got this working in Docker thanks to @maerics @chapmanjacobd @MDrooker, thanks all! See #96 (I'm 100% sure it can be improved after [or before?] merge 🎉 )

EDIT: just confirmed gl shaders work.

@monurcevik
Copy link

monurcevik commented Dec 9, 2020

Anyone solved this on Heroku? I tried running the following command on Heroku CLI and also tried to install xvfb but commands are not found.

xvfb-run -s "-ac -screen 0 1280x1024x24" <node program>

Also, I this same issue occurs on any other ffmpeg library I tested so far. Only way to bypass this AFAIK on Heroku was to execute the original ffmpeg shell script on runtime using child_process.

exec("ffmpeg -safe 0 -f concat -protocol_whitelist file,https,tls,tcp -i ${urlListPath} -c copy ${outPath}")

@patcon
Copy link
Contributor

patcon commented Dec 10, 2020

@monurcevik try this version of ffmpeg built with the flags in the upstream docker container (it's managed by core ffmpeg team):

FROM jrottenberg/ffmpeg:4.3.1-ubuntu1804

@monurcevik
Copy link

@patcon Thanks. However, I'm not using Docker at the moment. Do you know a workaround on Heroku without using Docker? Or is it mandatory?

@patcon
Copy link
Contributor

patcon commented Dec 10, 2020

I'm not sure "mandatory" is the right word, but it was mandatory for me :)

You might get better feedback by opening a new ticket, as Heroku support is perhaps a new thing with different requirements and context. As in, I have no idea whether you wrote your own buildpack or used existing ones, but it doesn't feel like this is the place to share that (11 ppl are getting notifications about each comment, after all)

@armandolio
Copy link

Hi! I'm trying to install on Ubuntu 18.04
node v12.18.2

and I receive the error:

Caught error Error: gl returned null, this probably means that some dependencies are not installed. See README. at module.exports (/usr/lib/node_modules/editly/glTransitions.js:12:11) at Editly (/usr/lib/node_modules/editly/index.js:172:60) at async /usr/lib/node_modules/editly/cli.js:136:3

can I solve without using docker? thanks!!

@patcon
Copy link
Contributor

patcon commented Dec 16, 2020

ffmpeg is probably one of the more important version numbers to share :)

@patcon
Copy link
Contributor

patcon commented Dec 16, 2020

In case dockerfiles aren't easy for ppl to read, this is the summary:

  • ubuntu 18.04
  • ffmpeg 4.3.1 (supplied by this upstream dockefile used in compilation, mostly bash RUN commands, but very long)
  • node 14.4.0

building ffmpeg with the same flags is probably where gotchas are. The pre-built ones in the package repos may or may not use all the same flags.

@armandolio
Copy link

armandolio commented Dec 16, 2020

Hi @patcon I updated the versions:

  • ffmpeg version 4.3.1
  • node v14.15.2

and throws the same error :(

@patcon
Copy link
Contributor

patcon commented Dec 16, 2020

Sorry, not sure then! You might want to clarify (for future travellers) if you built with all the same flags from the dockerfile I linked, so ppl will know which approach you've exhausted

@armandolio
Copy link

@Stefan-Hanke solution works for me #33 (comment)

If I run xvfb-run editly --json kenBurns.json5 the video is created. What's the downside of this technique?
I need to run from node, can I use this lib for that https://www.npmjs.com/package/xvfb ?

thanks!
Armando

@patcon
Copy link
Contributor

patcon commented Dec 17, 2020

Ah yes, the xvfb-run bit was 100% part of my dockerfile as well. Sorry if that wasn't clear before

@seanconrad1
Copy link

Also receiving this issue on
Ubuntu: 18.04
node: 15.8
ffmpeg: 9f38fac053010205806ece11e6aea9b7d3bde041 built using the static build: https://www.johnvansickle.com/ffmpeg/faq/

@Stefan-Hanke solution also worked for me but running from node is throwing the 'gl returned null (missing dependencies)' error

@changqing91
Copy link

macOS: BigSur 11.4
nodejs: v12.14.1
ffmpeg: 4.4
python: 3.9

$ editly --fast mosaic.json5 ffmpeg version 4.4 WARNING: ffmpeg issue: Invalid Version: 4.4 ffprobe version 4.4 WARNING: ffprobe issue: Invalid Version: 4.4 250x250 15fps Caught error Error: gl returned null, this probably means that some dependencies are not installed. See README. at module.exports (/usr/local/lib/node_modules/editly/glTransitions.js:12:11) at Editly (/usr/local/lib/node_modules/editly/index.js:172:60) at async /usr/local/lib/node_modules/editly/cli.js:136:3

@BrunoQuaresma
Copy link

I'm also having this issue trying to dockerize an API that uses editly. The error is:

Error: gl returned null, this probably means that some dependencies are not installed. See README.
    at module.exports (/usr/src/app/node_modules/editly/glTransitions.js:12:11)
    at Editly (/usr/src/app/node_modules/editly/index.js:172:60)

The Dockerfile is:

FROM  node:14

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
COPY tsconfig.json ./

# Necessary to run editly and node-gyp
RUN apt-get update && apt-get install -y \
    ffmpeg \
    build-essential \
    libxi-dev \
    libglu1-mesa-dev \
    libglew-dev \
    pkg-config \
    xvfb \
    
RUN npm install
# If you are building your code for production
# RUN npm ci --only=production

# Bundle app source
COPY . .

EXPOSE 8080
CMD [ "npm", "start" ]

@ariel-frischer
Copy link

ariel-frischer commented Dec 5, 2021

For me, these dockerfile RUN commands along with --server-num=1 CMD command seemed to fix things. I'm running this container inside AWS Lambda Functions! Also make sure in your .env you have DISPLAY=1. I had canvas installed elsewhere outside editly so I had to remove it from editly's node_modules folder:

FROM jrottenberg/ffmpeg:4.3.1-ubuntu1804

# Do my app specific build stuff...

# Source: https://gist.github.com/remarkablemark/aacf14c29b3f01d6900d13137b21db3a
# replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh

ENV CANVAS_RELEASE=${LAMBDA_TASK_ROOT}/node_modules/canvas/build/Release

RUN cd ${CANVAS_RELEASE} && rm libfribidi.so.0 libpango-1.0.so.0 libpangoft2-1.0.so.0

RUN apt-get update && apt-get -y --force-yes install x-window-system \
 && rm -rf /var/lib/apt/lists/*

RUN rm -rf ${LAMBDA_TASK_ROOT}/node_modules/editly/node_modules/canvas

ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_x86_64 /usr/bin/dumb-init
RUN chmod 0777 /usr/bin/dumb-init

EXPOSE 8080

ENTRYPOINT ["/usr/bin/dumb-init", "--" ] 
CMD [ "xvfb-run", "-a" , "--server-num=1", "-s", "-ac -screen 0 1920x1080x24 -noreset", "/usr/bin/npx", "/var/task/node_modules/aws-lambda-ric/bin/index.js", "/var/task/server/server.handler"]

@ascae
Copy link

ascae commented Apr 27, 2022

I got the same issue when trying to run editly on an Ubuntu github action runner
I fixed it by installing those dependencies first :

sudo apt-get install -y build-essential libxi-dev libglu1-mesa-dev libglew-dev pkg-config
sudo apt-get install -y python-is-python3
sudo add-apt-repository ppa:savoury1/ffmpeg4
sudo add-apt-repository ppa:savoury1/graphics
sudo add-apt-repository ppa:savoury1/multimedia
sudo apt-get install -y ffmpeg
sudo apt-get install -y xvfb
sudo apt full-upgrade

Then running my node command with xvfb :
xvfb-run -s "-ac -screen 0 1280x1024x24" node src/main.js

Hope it helps 🙂

@kkm
Copy link

kkm commented Jul 6, 2022

This is very important when I use ubuntu with desktop it works fine.

It works with screen -S xxx in desktop.

xvfb-run -s "-ac -screen 0 1280x1024x24" node src/main.js
It works in terminal without desktop well.

@teghmehta
Copy link

teghmehta commented Mar 31, 2023

This was my solution on AWS Lamba, Express, Docker

#165 (comment)

@zwdcoder
Copy link

@Stefan-Hanke What is the solution to the xvfb-run concurrency problem

@makeitcount
Copy link

makeitcount commented Sep 12, 2023

#100 solves the issue on Ubuntu but there has to be a better way to deal with this. Also I'm unable to make it work with pm2 ecosystem config - Unitech/pm2#5674

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests