我正在开发一个Grafana插件。我使用的是6.3.5版本的grafana。我从github克隆了这段代码,并使用以下命令构建grafana
go run build.go setup
go run build.go setup我从react plugin克隆了simple-react-panel代码。并将其放在插件文件夹中,然后使用yarn build构建插件。在那之后,我启动grafana服务器,插件工作正常。我已经在windows机器上做到了这一点。
现在我必须在linux机器上运行它。我在虚拟机上安装了grafana 6.3.5。我在grafana的simple-react-pnel文件夹中复制了相同的插件。在此之后,我使用yarn build构建插件。插件已经构建好了。现在,当我启动grafana服务器时,我可以看到我的插件,但当我单击该插件时,我得到错误Panel plugin not found: myorgid-simple-panel。在控制台中,我看到以下错误
Error loading panel plugin TypeError: r.PanelPlugin is not a constructor
at Module.eval (module.js:1)
at n (module.js:1)
at eval (module.js:1)
at eval (module.js:1)
at o (system.js:4)
at system.js:4
at system.js:4
at S (system.js:4)
at E (system.js:4)
at system.js:4问题是,同样的插件在windows系统上可以很好地与grafana一起工作,但在linux系统上不能工作。当我通过grafana-cli获得已安装插件的列表时,Grafana确实显示此插件已安装。

可能的问题是什么?
在运行yarn install之后,我得到了这样的结果:
yarn install v1.21.1
warning package-lock.json found. Your project contains lock files generated by t
ools other than Yarn. It is advised not to mix package managers in order to avoi
d resolution inconsistencies caused by unsynchronized lock files. To clear this
warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.11: The platform "linux" is incompatible with this module.
info "fsevents@1.2.11" is an optional dependency and failed compatibility check.
Excluding it from installation.
[3/4] Linking dependencies...
warning "@grafana/toolkit > @grafana/ui > @grafana/slate-react > slate-react-pla
ceholder@0.2.9" has unmet peer dependency "slate-react@>=0.22.0".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 34.68s.发布于 2020-01-31 17:42:00
有一个关于这方面的bug
https://github.com/grafana/grafana/issues/20338
然而,为什么它构建在windows而不是linux上还需要更多的调查。你确定grafana版本是一样的吗?
发布于 2020-02-03 22:12:49
花了两天时间,我终于解决了这个问题。问题出在Grafana Toolkit和Grafana UI包的版本上。由于我使用的是较旧版本的Grafana so,因此我必须使用较旧的Grafana Toolkit和Grafana UI包。我使用以下版本成功地解决了这个问题。
Grafana Toolkit : 6.4.4
Grafana UI : 6.3.2我从Grafana Toolkit和Grafana UI那里买的。
https://stackoverflow.com/questions/59999925
复制相似问题