- Electron version: 1.3.3
- Operating system: Ubuntu Linux 16.04 LTS
Hi, I am trying to read a json file using NodeJS's fs module. The path is correct, but when the app runs, it could not find the file.
Here is the block of code in a file called index.js:
// index.js
const fs = window.require('fs');
const path = window.require('path');
// get configuration file
const data = fs.readFileSync(path.join(__dirname, 'config.json'), 'utf8');
const config = JSON.parse(data);
Here is my app's structure:

The BrowserWindow then responded with this:

fs:js.640 then pointed to this:

I know this sounds like a problem with NodeJS, but I got the same code working outside of the app.
I hope this can be fixed, thanks in advance! :)
Hi, I am trying to read a
jsonfile using NodeJS'sfsmodule. The path is correct, but when the app runs, it could not find the file.Here is the block of code in a file called
index.js:Here is my app's structure:

The BrowserWindow then responded with this:

fs:js.640then pointed to this:I know this sounds like a problem with NodeJS, but I got the same code working outside of the app.
I hope this can be fixed, thanks in advance! :)