Unexpected token '<' Evaluating

Grafana : v7.0.3 (00ee734baf) on Windows 10

I have downloaded and unzipped this https://github.com/grafana/simple-datasource/tree/master/src simple
plugin template into the data/plugins folder unmodified. It shows up in the grafana datasources.

The path to the plugin json file is /data/plugins/myorgid-simple-datasource/plugin.json

I restarted the grafana service

When I choose the datasource, I get an error

Unexpected token ‘<’ Evaluating http://localhost:3000/public/plugins/myorgid-simple-datasource/module.js Loading plugins/myorgid-simple-datasource/module

After this, deleting the datasource is not possible because of an error “Missing valid datasource id”

Does anyone know why this happens and how I can solve it ?

Hi, you need to build the JS files so they are transpiled to the dist files. For that you’ll need to download the whole repo instead just src part and run yarn build inside of it.

@alexkhomenko, been there, done that, and it works.

I am not experienced with yarn or such tools. I tried the yarn watch and it looks to me that then I can follow some live events from the plugin, but then should I do all this inside the data folder from grafana ?, or how can I do some live debugging with this (cannot is also an answer :wink:

If you just want to run a plugin, building it once should be enough. yarn watch is useful when you want to develop a plugin or make some changes to it. Here’s more info about plugin development: https://grafana.com/docs/grafana/latest/developers/plugins/

I have seen those pages but they lead me nowhere so far. They give some commands, and when I execute them I see some things happening, getting loads of warnings and sometimes errors/failures.

Anyway, now that I have a working simple datasource plugin, I can (hopefully) find my way to achieve my goal… and that is a mssql data source with a query builder where the [noob] user can only select a signal name from a list of metrics, and then get the graph.

1 Like

Works were interrupted by a business trip. Picking up again and going to find out how and what I can do with this template plugin. The structure looks slightly different from the existing mssql plugin, so lots of compilation errors when I try to change things… but that’s the learning stage. I will try to keep some progress posted here.