ngfelixl / nodeplotlib

NodeJS plotting library for JavaScript and TypeScript. On top of plotly.js. Inspired by matplotlib.
https://www.npmjs.com/package/nodeplotlib
MIT License
195 stars 24 forks source link

TypeError: i.createServer is not a function #28

Closed kargapoltsev closed 4 years ago

kargapoltsev commented 4 years ago

./node_modules/nodeplotlib/dist/lib/index.js/</</c</e.prototype.createServer node_modules/nodeplotlib/dist/lib/index.js:150

147 | } 148 | }, e.prototype.createServer = function () { 149 | var e = this;

150 | return i.createServer(function (t, n) { | ^ 151 | e.serveData(t, n), e.serveWebsite(t, n); 152 | }); 153 | }, e.prototype.serveData = function (e, t) {A clear and concise description of what the bug is.

After importing lib

import { plot, Plot } from 'nodeplotlib';

I got this. I can't find something about this issue.

ngfelixl commented 4 years ago

Thank you for submitting the issue. Can you please add some details about your nodejs version and general setup? Do you use typescript?

kargapoltsev commented 4 years ago

I have try to change node versions. First I coutght this issue with 8.10. Next I updated to 13.12. And now I roll backed to 11.15. I have test it with both react projects with typescript and without it.

ngfelixl commented 4 years ago

You can only use the library with NodeJS. React runs in the browser and won't be able to start a webserver here. For plotting in React please use https://plotly.com/javascript/ or another plotting library.