虽然following the instructions使用Meteor中Plotly的React组件,
import createPlotlyComponent from 'react-plotlyjs';
import Plotly from 'plotly.js/dist/plotly-cartesian';
const PlotlyComponent = createPlotlyComponent(Plotly);
给出错误
Uncaught Error: Cannot find module 'plotly.js/dist/plotly-cartesian'
我们如何安装/加载plotly-cartesian
?已经安装了react-plotlyjs
NPM包。
的package.json
{
"name": "chart-test",
"private": true,
"scripts": {
"start": "meteor run"
},
"dependencies": {
"babel-runtime": "^6.23.0",
"meteor-node-stubs": "~0.2.0",
"meteor-rxjs": "^0.4.7",
"pondjs": "^0.8.4",
"react": "^15.4.2",
"react-addons-pure-render-mixin": "^15.4.2",
"react-dom": "^15.4.2",
"react-plotlyjs": "^0.4.0",
"react-router": "^3.0.2",
"rxjs": "^5.2.0"
}
}
答案 0 :(得分:0)
您可能错过了
"plotly.js": "^1.26.1",
适用于我的情节解决方法是导入'plotly.js/dist/plotly'
而不是笛卡尔版本。
此问题可能符合此建议:https://github.com/benjeffery/react-plotlyjs/issues/15