title: Unable to run script using webpack with npm or yarn - "Couldn't find the binary"
body: <h1>Description</h1>
  
  <p>I'm trying to build my first React website using webpack. With gulp it builds fine. However when trying to build under administrator using webpack, when I run my script 'build' using the command 'yarn build', I get the following error:</p>
  
  <pre><code>error An unexpected error occurred: "Couldn't find the binary C:\\WINDOWS\\system32\\cmd.exe;".
  </code></pre>
  
  <h1>Configuration</h1>
  
  <p>My node version is <code>v9.8.0</code></p>
  
  <p>My yarn version is <code>1.5.1</code></p>
  
  <p>My package.json:</p>
  
  <pre><code> {
    "name": "mywebsite",
    "version": "1.0.0",
    "description": "My personal website.",
    "main": "./src/App.jsx",
    "scripts": {
      "build": "webpack-dev-server --config ./webpack.config.js --mode development"
    },
    "author": "Akli Aissat",
    "license": "ISC",
    "dependencies": {
      "react": "^16.2.0",
      "react-dom": "^16.2.0",
      "react-router-dom": "^4.2.2"
    },
    "devDependencies": {
      "babel-core": "^6.26.0",
      "babel-loader": "^7.1.4",
      "babel-preset-env": "^1.6.1",
      "babel-preset-react": "^6.24.1",
      "webpack": "^4.1.1",
      "webpack-cli": "^2.0.12",
      "webpack-dev-server": "^3.1.1"
    }
  }
  </code></pre>
  
  <p>My .babelrc:</p>
  
  <pre><code>{"presets": ["env", "react"]}
  </code></pre>
  
  <p>My webpack.config.js:</p>
  
  <pre><code>const path = require("path");
  
  module.exports = {
    entry: "./src/App",
    output: {
      path: path.resolve(__dirname, "dist"),
      filename: "bundle.js"
    },
    module: {
      rules: [
        {
          test: /\.(js|jsx)$/,
          exclude: /node_modules/,
          use: {
            loader: "babel-loader"
          }
        }
      ]
    },
    devServer: {
      contentBase: path.join(__dirname, 'dist')
    }
  };
  </code></pre>
  
  <p>I've also added Yarn to my environment variable Path.</p>
  
  <h1>Error Logs</h1>
  
  <p>My yarn-error.log doesn't really give me any additional information about the error:</p>
  
  <pre><code>Trace: 
    Error: Couldn't find the binary C:\WINDOWS\system32\cmd.exe;
        at ProcessSpawnError.MessageError (C:\Program Files (x86)\Yarn\lib\cli.js:186:110)
        at new ProcessSpawnError (C:\Program Files (x86)\Yarn\lib\cli.js:201:118)
        at ChildProcess.&lt;anonymous&gt; (C:\Program Files (x86)\Yarn\lib\cli.js:30237:18)
        at ChildProcess.emit (events.js:180:13)
        at Process.ChildProcess._handle.onexit (internal/child_process.js:207:12)
        at onErrorNT (internal/child_process.js:379:16)
        at process._tickCallback (internal/process/next_tick.js:114:19)
  </code></pre>
  
  <p>Any help would be very much appreciated. Thanks.</p>