In index.js
I have
'use strict';
const config = require('./config');
In config.js
I have
'use strict';
const config = new function() {
this.port = 3000;
this.redirectUri = "http://localhost:" + this.port + "/auth";
}
module.exports = config;
On x64 Windows running node v6.9.5 this runs fine.
On a Raspberry Pi Zero (Raspbian Pixel, ARM v6) running node 6.10.2 however, I get the following error:
module.js:590
throw err;
^
SyntaxError: /home/pi/pihas-api/config.json: Unexpected token ' in JSON at position 0
at Object.parse (native)
at Object.Module._extensions..json (module.js:587:27)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/pi/pihas-api/index.js:8:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
I know this is because I'm using 'use strict';
in config.js
, but I'm wondering why it does work on Windows, and whether or not there's a way to get this to work on the Pi Zero as well.
via Joris
No comments:
Post a Comment