I am trying to runt the following code on using node:
const require = require("requirejs");
require.config({
paths: {
d3: 'https://cdnjs.cloudflare.com/ajax/libs/d3/5.16.0/d3.min',
plotly: 'https://cdn.plot.ly/plotly-latest.min',
jquery: 'https://code.jquery.com/jquery-3.3.1.min'
},
shim: {
plotly: {
deps: ['d3', 'jquery'],
exports: 'plotly'
}
}
});
require(['plotly'], function(Plotly) {
window.Plotly = Plotly;
})
Inspiration for this comes from here: Link
Now when I run:
node main.js
I get the following error:
throw err;
Error: Tried loading "plotly" at https://cdn.plot.ly/plotly-latest.min.js then tried node's require("plotly") and it failed with error: Error: Cannot find module 'plotly'
Could someone please kindly explain what is going on and how I can fix this error message?
window.Plotlywould just fail. Also unclear why you're using RequireJS and what you're planning to do with jQuery.