Trying to create a grafana plugin

Hi everyone !

I’m trying to create my own grafana plugin but I have some issue. I want to add ponctual events on a graph by checking check box for each type of events. I tried to start from the existing graph plugin but it’s impossible I have to start from the beginning. I try to follow the tutorial https://grafana.com/blog/2016/04/08/timing-is-everything.-writing-the-clock-panel-plugin-for-grafana-3.0/ .

But when I want to run the commande line

npm install

I have the error :

EJSONPARSE
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected string in JSON at position 219 while parsing '{
npm ERR! JSON.parse   "name": "perso",
npm ERR! JSON.parse   "version": "1.0.0'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.

The paquage.json :

    {
  "name": "perso",
  "version": "1.0.0",
  "description": "check box",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "jojo",
  "license": "MIT"

  "devDependencies": {
  "grunt": "~0.4.5",
  "babel": "~6.5.1",
  "grunt-babel": "~6.0.0",
  "grunt-contrib-copy": "~0.8.2",
  "grunt-contrib-watch": "^0.6.1",
  "grunt-contrib-uglify": "~0.11.0",
  "grunt-systemjs-builder": "^0.2.5",
  "load-grunt-tasks": "~3.2.0",
  "grunt-execute": "~0.2.2",
  "grunt-contrib-clean": "~0.6.0",
  "babel-plugin-transform-es2015-modules-systemjs": "^6.5.0",
  "babel-preset-es2015": "^6.5.0"
}
}

In addition, when I start the server it doesn’t see the plugin. It see the other plugin on the folder but not mine.
I have the plugin.json done and the module.json on subfolder ‘src’.

The plugin.json :

{
  "type": "panel",
  "name": "check box",
  "id": "grafana-checkbox-panel",

  "info": {
    "description": "Clock panel for grafana",
    "author": {
      "name": "Raintank Inc.",
      "url": "http://raintank.io"
    },
    "keywords": ["clock", "panel"],
    "version": "1.0.0",
    "updated": "2015-03-24"
  },

  "dependencies": {
    "grafanaVersion": "3.x.x",
    "plugins": [ ]
  }
} 

Someone can help me with this error :confused: I searched for hours on google but nothing, I cannot figure out what’s the problem here !

You’re missing a comma between “MIT” and “devDependencies”

1 Like

What a mess ! Really thank you for guiding the noob I am :smiley:

1 Like

No problem! We’ve all be there. Glad I could help :grinning:

1 Like

If I make some modification on the module.ts. Do I have to rebuild the plugins ? Like compilation ?

I’m sorry, I’m new doing programmation on the server side !