question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plotly.js requires gl in Electron contexts

See original GitHub issue

When using plotly.js in an Electron app, it requires gl. I’m guessing this is because Plotly.js determines that it’s running in a node context, even though there is a window and a full browsing environment available. Installed gl for now, figured I’d post an issue. I’ll link to the relevant PR on the nteract side shortly.


For those that stumble upon this issue, make sure to use:

const plotly = require('plotly.js/dist/plotly.js');

When requiring plotly. Everything will then work just fine in Electron land.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:25 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
rgbkrkcommented, Oct 19, 2016

I’ve updated the issue description to include the require into dist so people who end up at this issue see the way to handle it upfront.

1reaction
FrantisekGazocommented, Oct 18, 2016

I got the Uncaught Error: Cannot find module 'gl' when trying the plotly.js in Electron app.

I installed version 1.18.1 via npm install plotly.js

only require('plotly.js/dist/plotly.js') works

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue in Electron built version - plotly.js
I'm using the plotly. js library to display charts in my application. While the library works fine when running either serve script, the...
Read more >
glslify - npm
A node.js-style module system for GLSL! This module contains: glslify's command-line interface (CLI); glslify node/electron interface ...
Read more >
npm - Snyk
@alancnet/fantasy-names · @alexamies/chinesedict-js · @alifd/next · @alpacahq/alpaca-trade-api · @amcharts/amcharts3-angular · @amcharts/amcharts4 ...
Read more >
A curated list of awesome things related to Vue.js
Dockeron - A project built on Electron + Vue.js for Docker on desktop. ... vue-mapbox-gl - Vue 2.x component for Mapbox GL JS...
Read more >
Clustering 4000 Stack Overflow tags with BigQuery k-means
Do we really need 4,000 one-hot encoded dimensions to obtain better ... parent-child, liquid, mapbox-gl-js, focus, angularjs-ng-repeat, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found