vesparny / fair-analytics

📊 An analytics server that doesn't undermine user's privacy
MIT License
748 stars 24 forks source link

Throws a Syntax Error during startup #8

Closed leosco closed 7 years ago

leosco commented 7 years ago

Following the instructions for programmatic integration, using Node v4.8.2 on Windows.

import appRoot from 'app-root-path';
import fa from 'fair-analytics';

const server = fa({
  storageDirectory: `${appRoot}/.analytics`,
});

const { feed } = server;

feed.on('ready', () => {
  server.listen(8080);
});
W20170510-17:28:59.780(-4)? (STDERR) const { json, send } = micro
W20170510-17:28:59.781(-4)? (STDERR)       ^
W20170510-17:28:59.781(-4)? (STDERR)     -
W20170510-17:28:59.782(-4)? (STDERR) SyntaxError: Unexpected token {
W20170510-17:28:59.782(-4)? (STDERR)     at exports.runInThisContext (vm.js:53:16)
W20170510-17:28:59.782(-4)? (STDERR)     at Module._compile (module.js:373:25)
W20170510-17:28:59.782(-4)? (STDERR)     at Object.Module._extensions..js (module.js:416:10)
W20170510-17:28:59.783(-4)? (STDERR)     at Module.load (module.js:343:32)
W20170510-17:28:59.783(-4)? (STDERR)     at Function.Module._load (module.js:300:12)
W20170510-17:28:59.783(-4)? (STDERR)     at Module.require (module.js:353:17) 
W20170510-17:28:59.783(-4)? (STDERR)     at require (internal/module.js:12:17)
W20170510-17:28:59.784(-4)? (STDERR)     at Object.<anonymous> (.\node_modules\fair-analytics\lib\fair-analytics.js:2:22)
W20170510-17:28:59.784(-4)? (STDERR)     at Module._compile (module.js:409:26)ject metadata
W20170510-17:28:59.784(-4)? (STDERR)     at Object.Module._extensions..js (module.js:416:10)
vesparny commented 7 years ago

Hi, Can you post the error? Which node version are you using?

leosco commented 7 years ago

I updated my first comment, see above ^^^

vesparny commented 7 years ago

I'm afraid the minimum required node version is >=6

vesparny commented 7 years ago

I should probably make it clearer in the readme

leosco commented 7 years ago

@vesparny Sadness, that makes sense. Most of my production apps use Meteor, so the version is locked to v4 right now. Good to know! Thanks for the response

vesparny commented 7 years ago

I guess you can use nvm to run different node version on the same server