title: Electron failed to install correctly, please delete node_modules/ and try installing again
body: <p>I am trying to use webpack + react + electron, and when I type in the CLI "electron ."  it gives me this error:</p>
  
  <p><a href="https://i.stack.imgur.com/qiAbM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qiAbM.png" alt=""></a></p>
  
  <p>I deleted node_modules and re-installed all the modules over and over like about 6 times, obviously deleting node_modules and installing isn't a solution, so I need the community's help on finding this error.</p>
  
  <p><strong>package.json</strong></p>
  
  <pre><code>{
    "name": "ElectronULTIMA",
    "version": "1.0.0",
    "description": "electron apps",
    "main": "main.js",
    "scripts": {
      "start": "electron .",
      "babel": "babel",
      "webpack": "webpack"
    },
    "author": "",
    "license": "ISC",
    "devDependencies": {
      "babel-core": "^6.23.1",
      "babel-loader": "^6.3.2",
      "babel-preset-es2015": "^6.22.0",
      "babel-preset-react": "^6.23.0",
      "electron": "^1.6.1",
      "electron-packager": "^8.5.2",
      "electron-prebuilt": "^1.4.13",
      "webpack": "^2.2.1",
      "webpack-dev-server": "^2.4.1"
    },
    "dependencies": {
      "bootstrap": "^3.3.7",
      "electron": "^1.6.1",
      "electron-prebuilt": "^1.4.13",
      "react": "^15.4.2",
      "react-bootstrap": "^0.30.7",
      "react-dom": "^15.4.2",
      "react-modal": "^1.7.1"
    }
  }
  </code></pre>
  
  <p><strong>main.js</strong></p>
  
  <pre><code>const electron = require('electron');
  const {app, dialog, Menu, Tray, BrowserWindow} = require('electron');
  const remote = require('electron').remote;
  const path = require('path');
  const url = require('url');
  const $ = jQuery = require('jquery');
  const ipc = require('electron').ipcMain;
  const fs = require('fs');
  const AWS = require('aws-sdk');
  const ep = new AWS.Endpoint('dynamodb.us-west-1.amazonaws.com');
  const db = new AWS.DynamoDB.DocumentClient({      // Dynamo database constructor
      "apiVersion": '2012-08-10',
      "region": 'us-west-1',
      "endpoint": ep,
      "accessKeyId": '*censored*',
      "secretAccessKey": '*censored*'
  });
  
  
  // ---------------------------------------------------------------------------------------------------------- //
  // ---------------------------------------------------------------------------------------------------------- //
  // ---------------------------------------------------------------------------------------------------------- //
  // ---------------------------------------------------------------------------------------------------------- //
  // ---------------------------------------------------------------------------------------------------------- //
  //  RENDER COMMUNICATION
  // ---------------------------------------------------------------------------------------------------------- //
  // ---------------------------------------------------------------------------------------------------------- //
  let win; // Main project window
  let rnews; // Rnews window
  
      win = new BrowserWindow({ width: 900, height: 700 });
      win.loadURL(`file://${__dirname}/index.html`);
      //win.openDevTools();
  
  
  
  
      // ----------------------------------------------------------------------------------- //
      // ----------------------------------------------------------------------------------- //
      // ----------------------------------------------------------------------------------- //
      // RNEWS WINDOW INSTANCE
      // ----------------------------------------------------------------------------------- //
      rnews = new BrowserWindow({ width: 620, height: 900, show: false, backgroundColor: '#2e2c29', title: '"R" News Articles' });
      // useContentSize (boolean)
      // RNEWS WINDOW VISIBILITY
      ipc.on('rnews', () =&gt; {
          rnews.loadURL(`file://${__dirname}/rnews/index.html`);
          //rnews.openDevTools();
          if (rnews.isVisible()) { rnews.hide(); }
          if (!rnews.isVisible()) { rnews.show(); }
      });
  
  
  
      win.on('closed', () =&gt; { win = null; });
      rnews.on('closed', () =&gt; { rnews = null; });
      rnews.on('ready-to-show', () =&gt; {
        rnews.show();
      });
  }
  
  // ---------------------------------------------------------------------------------------------------------- //
  // ---------------------------------------------------------------------------------------------------------- //
  // ---------------------------------------------------------------------------------------------------------- //
  // ---------------------------------------------------------------------------------------------------------- //
  // ---------------------------------------------------------------------------------------------------------- //
  //  GLOBAL SCOPE
  // ---------------------------------------------------------------------------------------------------------- //
  // ---------------------------------------------------------------------------------------------------------- //
  app.on('ready', MAIN_WINDOW);
  // When the last window is closed
  app.on('window-all-closed', () =&gt; {
      app.quit();
  });
  app.on ('activate', () =&gt; {
      if (win === null) {
          MAIN_WINDOW();
      }
  });
  </code></pre>
  
  <p><strong>webpack.config.js</strong></p>
  
  <pre><code>const path = require('path');
  const webpack = require('webpack');
  
  module.exports = {
      devtool: 'inline-source-map',
      entry: [
        './index.js'
      ],
      output: { path: __dirname, filename: './bundle.js' },
      resolve: { modules: ['node_modules', 'src'], extensions: ['.js'] },
      watch: true,
      module: {
          loaders: [
              {
                  test: /\.jsx?$/,
                  loader: 'babel-loader',
                  exclude: /node_modules/,
                  query: {
                    presets: ['es2015', 'react']
                  }
              }
          ]
      },
      target: "node",
      plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoEmitOnErrorsPlugin()
      ]
  }
  </code></pre>
  
  <p><strong>index.js</strong></p>
  
  <pre><code>import React from 'react';
  import ReactDOM from 'react-dom';
  import { InputGroup, Button, ButtonToolbar, ButtonGroup, FormControl, FormGroup, render } from 'react-bootstrap';
  import ReactModal from 'react-modal';
  const AWS = require('aws-sdk');
  const ep = new AWS.Endpoint('dynamodb.us-west-1.amazonaws.com');
  const db = new AWS.DynamoDB.DocumentClient({      // Dynamo database constructor
      "apiVersion": '2012-08-10',
      "region": 'us-west-1',
      "endpoint": ep,
      "accessKeyId": '*censored*',
      "secretAccessKey": '*censored*'
  });
  
  
  const GRAB_RNEWS_ARTICLES = new Promise((resolve, reject) =&gt; {
    db.scan({ TableName: 'Rnews' }, (error, articles) =&gt; {
      if (error) reject (error);
      resolve(articles);
    });
  });
  
  function RenderImage(props) {
    // If thumbnailOrNo is passed as a prop give it the class "rnewsThumbnails"
    if (props.thumbnailOrNo) {
      return (
        &lt;img src={props.imageUrl} className="img-rounded rnewsThumbnails"&gt;&lt;/img&gt;
      )
    } else {
      return (
        &lt;img src={props.imageUrl} className="img-rounded"&gt;&lt;/img&gt;
      )
    }
  }
  
  
  
  
  
  RNEWS();
  function RNEWS() {
    GRAB_RNEWS_ARTICLES.then(rArticles =&gt; {
  
      $(function() {
        // Make all links open in new tab
        $("a").attr('target', '_blank');
      });
  
      class RNEWS_Templating extends React.Component {
        constructor(props) {
          super(props);
          // don't forget this.props.article is passed as an individual article
        }
        render() {
          let defaultImg = 'https://lh3.googleusercontent.com/-Lk5XNJRyFKw/AAAAAAAAAAI/AAAAAAAAAA0/xkk9_owpEhE/photo.jpg';
          return (
            &lt;div className="panel panel-warning"&gt;
              &lt;div className="panel-body"&gt;
                &lt;div className="col-sm-2"&gt;
                  &lt;strong className="articlesource"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{this.props.article.source}&lt;/strong&gt;
                  &lt;br /&gt;
                  &lt;RenderImage imageUrl={this.props.article.imgUrl || defaultImg } thumbnailOrNo="yes" /&gt;
                &lt;/div&gt;
                &lt;div className="col-sm-10"&gt;
                    &lt;strong&gt;Short title: &lt;/strong&gt;&lt;span className="rnewsshorttitle"&gt;&lt;font size="4"&gt;{this.props.article.title}&lt;/font&gt;&lt;/span&gt;
                    &lt;br /&gt;
                    &lt;span className="rnewsdescription"&gt;{this.props.article.description}&lt;/span&gt;
                    &lt;br /&gt;
                  &lt;a href={this.props.article.url}&gt;{this.props.article.url}&lt;/a&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          );
        }
      }
  
      // ----------------------------------------------------------------------------------- //
      // RNEWS_Parent will hold the states
      // ----------------------------------------------------------------------------------- //
      class RNEWS_Parent extends React.Component {
        constructor(props) {
          super(props);
          this.state = {
            articles: this.props.rArticles.Items,
            searchVal: "",
            titles: []
          }
          this.searchValueUpdater = this.searchValueUpdater.bind(this);
        }
        searchValueUpdater(e) {
          this.setState({ searchVal: e.target.value })
        }
        componentWillMount() {
          this.state.articles.map(article =&gt; {
            return this.state.titles.push(article.title);
          })
        }
        render() {
          // Will be used to show only 10 articles
          let TwentyArticles = 0;
          return (
            &lt;div className="container"&gt;
              &lt;div className="well row"&gt;
                &lt;center&gt;
                  &lt;font size="5"&gt;"R" News Articles (ascending order)&lt;/font&gt;
                &lt;/center&gt;
                &lt;div&gt;
                  &lt;h6&gt;Total articles: &lt;span className="goldenvalue"&gt;{this.props.rArticles.Count}&lt;/span&gt;&lt;/h6&gt;
                  &lt;h6&gt;Total scanned articles: &lt;span className="goldenvalue"&gt;{this.props.rArticles.ScannedCount}&lt;/span&gt;&lt;/h6&gt;
                &lt;/div&gt;
                &lt;FormGroup bsSize="sm" controlId="rnewsSearch" validationState="success"&gt;
                  &lt;FormControl
                    placeholder="Search for an article"
                    inputRef={(input) =&gt; { this.input = input; }}
                    onChange={this.searchValueUpdater}
                    &gt;
                  &lt;/FormControl&gt;
                &lt;/FormGroup&gt;
                &lt;span&gt;{this.state.searchVal}&lt;/span&gt;
                &lt;div&gt;
                  &lt;h3&gt;&lt;font color="magenta"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Articles: &lt;/font&gt;&lt;/h3&gt;
                  &lt;br /&gt;&lt;br /&gt;
                  &lt;div className="col-sm-8"&gt;
                      {this.state.articles.map((articleObj, key) =&gt; {
                        TwentyArticles++;
                        if (TwentyArticles &gt; 20) { return; }
                        return &lt;RNEWS_Templating article={articleObj} /&gt;
                      })}
                  &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          );
        }
      }
  
  
      ReactDOM.render(&lt;RNEWS_Parent rArticles={rArticles}/&gt;, document.getElementById("ace"));
    });
  }
  </code></pre>