title: Module not found: Error: Cannot resolve module '@types/lodash'
body: <p>I'm stuck and looking for help.</p>
  
  <p>I'm not sure where the problem actually is but I hope to find the answer. </p>
  
  <h2>Problem details</h2>
  
  <p>I've installed '@types/lodash' using following command:</p>
  
  <pre><code>npm install --save-dev @types/lodash
  </code></pre>
  
  <p>And imported lodash in my .ts file using:</p>
  
  <pre><code>import * as _ from '@types/lodash';
  </code></pre>
  
  <p>When I run webpack I get following error:</p>
  
  <pre><code>ERROR in ./app/scripts/Components/GameBoard.ts
  Module not found: Error: Cannot resolve module '@types/lodash' in /Users/mjelaska/Documents/DevProjects/connect-four/src/app/scripts/Components
   @ ./app/scripts/Components/GameBoard.ts 3:8-32
  </code></pre>
  
  <p>Then I tried to get more details with</p>
  
  <pre><code>webpack --display-error-details
  </code></pre>
  
  <p>and got ⇣</p>
  
  <pre><code>ERROR in ./app/scripts/Components/GameBoard.ts
  Module not found: Error: Cannot resolve module '@types/lodash' in /Users/mjelaska/Documents/DevProjects/connect-four/src/app/scripts/Components
  resolve module @types/lodash in /Users/mjelaska/Documents/DevProjects/connect-four/src/app/scripts/Components
    looking for modules in /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules
      resolve 'file' or 'directory' lodash in /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types
        resolve file
          /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash.webpack.js doesn't exist
          /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash is not a file
          /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash.web.js doesn't exist
          /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash.ts doesn't exist
          /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash.js doesn't exist
        resolve directory
          directory default file index
            resolve file index in /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash
              /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index doesn't exist
              /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index.webpack.js doesn't exist
              /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index.web.js doesn't exist
              /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index.ts doesn't exist
              /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index.js doesn't exist
          use  from package.json
            resolve 'file' or 'directory' /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash
              resolve file
                /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash is not a file
                /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash.webpack.js doesn't exist
                /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash.web.js doesn't exist
                /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash.ts doesn't exist
                /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash.js doesn't exist
              resolve directory
                use  from package.json
                  abort resolving because of recursion
                directory default file index
                  resolve file index in /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash
                    /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index doesn't exist
                    /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index.webpack.js doesn't exist
                    /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index.web.js doesn't exist
                    /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index.ts doesn't exist
                    /Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index.js doesn't exist
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash.webpack.js]
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash.web.js]
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash.ts]
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash.js]
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index]
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index.webpack.js]
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index.web.js]
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index.ts]
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index.js]
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash.webpack.js]
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash.web.js]
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash.ts]
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash.js]
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index]
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index.webpack.js]
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index.web.js]
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index.ts]
  [/Users/mjelaska/Documents/DevProjects/connect-four/src/node_modules/@types/lodash/index.js]
   @ ./app/scripts/Components/GameBoard.ts 3:8-32
  </code></pre>
  
  <h2>Setup details</h2>
  
  <h3>package.json (w/o some irrelevant info)</h3>
  
  <pre><code>{
    "devDependencies": {
      "@types/lodash": "^4.14.47",
      "@types/node": "^6.0.55",
      "@types/pixi.js": "^4.3.1",
      "npm": "^4.0.5",
      "ts-loader": "^1.3.3",
      "typescript": "^2.1.4",
      "webpack": "^1.14.0"
    }
  }
  </code></pre>
  
  <h3>tsconfig.json</h3>
  
  <pre><code>{
      "compilerOptions": {
          "module": "commonjs",
          "target": "es5",
          "noImplicitAny": true,
          "sourceMap": false,
          "removeComments": true,
          "typeRoots": [
            "./node_modules/@types"
          ]
      },
      "files": [
        "./app/scripts/main.ts"
      ]
  }
  </code></pre>
  
  <h3>webpack.config.js</h3>
  
  <pre><code>module.exports = {
      entry: './app/scripts/main.ts',
      output: {
          filename: './build/scripts/main.js'
      },
      resolve: {
          extensions: ['', '.webpack.js', '.web.js', '.ts', '.js']
      },
      module: {
          loaders: [
              {
                  test: /\.ts$/,
                  loader: 'ts-loader'
              }
          ]
      }
  };
  </code></pre>
  
  <h2>Environment details</h2>
  
  <pre><code>node: v6.9.4
  npm: v4.0.5
  webpack: v1.14.0 (as seen in `package.json`, installed also globally)
  </code></pre>
  
  <p>Project at the moment when problem occurred: <a href="https://github.com/MiroslavJelaska/connect-four/tree/4941ca792096602831940f76fa350e461808a8c5" rel="noreferrer">https://github.com/MiroslavJelaska/connect-four/tree/4941ca792096602831940f76fa350e461808a8c5</a></p>
  
  <h1>⬆️ Update #1</h1>
  
  <p>Installing lodash to dependencies instead of devDependencies doesn't help:</p>
  
  <pre><code>npm install --save @types/lodash
  </code></pre>