"ENOENT: no such file or directory, open" Error after Build


#1

Hi

I’ve got a config file which works well while I’m developing but after the build I’m getting the following error
Uncaught Exception:
Error: ENOENT: no such file or directory, open ‘config/app.json’

Here is the code I’m using to create the path:

const configFile = path.join(__dirname, '/config/app.json')
const configRead = fs.readFileSync(configFile)
const config = JSON.parse(configRead)

#2

What does __dirname return?


#3

There was an issue with electron package. Deleting all node_modules and run npm install has fixed the issue. Thanks