Browse Source

Update index.js

Samuel Attard 8 years ago
parent
commit
5c8ebb296c
1 changed files with 7 additions and 1 deletions
  1. 7 1
      npm/index.js

+ 7 - 1
npm/index.js

@@ -1,4 +1,10 @@
 var fs = require('fs')
 var path = require('path')
 
-module.exports = path.join(__dirname, fs.readFileSync(path.join(__dirname, 'path.txt'), 'utf-8'))
+const pathFile = path.join(__dirname, 'path.txt')
+
+if (fs.existsSync(pathFile)) {
+  module.exports = path.join(__dirname, fs.readFileSync(pathFile, 'utf-8'))
+} else {
+  throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again');
+}