title: Cannot find type definition file for 'node' in Typescript/React app
body: <p>I noticed not too long ago, whenever I try to start my app, I receive plenty of <code>Cannot find name 'require'</code> and <code>Cannot find type definition file for 'node'</code> and a <code>Cannot find type definition for 'react-router'</code></p>
  
  <p>Some solutions I have already tried are:</p>
  
  <p>1) adding a <code>types: ["node"]</code> in my tsconfig.json, as you all can see below.</p>
  
  <p>2) adding <code>@types/node</code> in my package.json, which you all can see here.</p>
  
  <p>3) removing node_modules and re <code>yarn</code>ing, to no avail. I've also deleted yarn.lock as well and the issue persists.</p>
  
  <p>4) Adding a <code>typeRoots: ["node_modules/@types/node"]</code>, which didn't seem to do much.</p>
  
  <pre><code>// Package.json 
  "devDependencies": {
      "@types/lodash": "^4.14.110",
      "@types/node": "^10.12.18",
      "@types/react": "16.3.12",
      "@types/react-dom": "15.5.0",
      "@types/react-router": "4.0.11",
      "babel-core": "6.26.3",
      "babel-loader": "7.1.5",
      "babel-preset-es2015": "6.24.1",
      "babel-preset-react": "6.24.1",
      "css-loader": "1.0.0",
      "extract-text-webpack-plugin": "2.0.0-beta.4",
      "html-webpack-plugin": "2.24.1",
      "react": "15.5.4",
      "react-dom": "15.5.4",
      "react-router-dom": "4.1.1",
      "rimraf": "2.6.2",
      "style-loader": "0.22.1",
      "ts-loader": "1.2.1",
      "typescript": "3.2.2",
      "url-loader": "1.0.1",
      "webpack": "2.2.0",
      "webpack-dev-server": "1.16.2"
    }
  
  //tsconfig.json (at root level)
  {
      "compilerOptions": {
      "baseUrl": "./",
      "target": "es2016",
      "pretty": true,
      "module": "commonjs",
      "sourceMap": true,
      "jsx": "preserve",
      "outDir": "./dist/",
      "noImplicitAny": false,
      "preserveConstEnums": true,
      "strict": true,
      "allowSyntheticDefaultImports": true,
      "types": ["node"],
      "paths": {
        "*": ["node_modules/@types/*", "*"]
      }
    },
    "include": [
      "src/**/*"
    ],
    "exclude": [
      "node_modules"
    ]
  }
  </code></pre>
  
  <p>The above tsconfig and package.json combination yield the following errors:</p>
  
  <pre><code>ERROR in ./src/index.tsx
  (5,1): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig.
  
  ERROR in /Users/johnli/Documents/portfolio/tsconfig.json
  error TS2688: Cannot find type definition file for 'node'.
  </code></pre>
  
  <p>Some odd behavior that I noticed is that adding <code>types: ["node"]</code> will erase my <code>Cannot find type definition file for 'react-router'</code> but not for <code>node</code>. Adding <code>react-router</code> produces the error for both <code>node</code> and <code>react-router</code>, and removing the <code>types</code> attribute entirely also yields an error for both <code>node</code> and <code>react-router</code>.</p>
  
  <p>I would like to refrain from using <code>declare var require: any</code> as the solution, since that doesn't resolve the heart of the issue and more of a patch.</p>
  
  <p>Some more information should it be useful: node version is <code>11.6.0</code> and yarn version is <code>1.13.0</code></p>
  
  <p>Any other suggestions to get this working? I can't seem to find any other solutions aside from the ones I tried above. I can also supply more information should that be needed. Thanks all!</p>