“ERROR in Entry module not found” for module that exists

Bash log:

~/code/blockai/merkletree$ npm run gh-pages:build

> merkletree@1.4.0 gh-pages:build /Users/olalonde/code/blockai/merkletree
> cd demo && rm -rf dist && webpack

Hash: 396f0bfb9d565b6f60f0
Version: webpack 1.13.0
Time: 25ms

ERROR in Entry module not found: Error: Cannot resolve module 'app.js' in /Users/olalonde/code/blockai/merkletree/demo/src
~/code/blockai/merkletree$ ls /Users/olalonde/code/blockai/merkletree/demo/src
app.js
~/code/blockai/merkletree$ cat demo/webpack.config.js
module.exports = {
  context: `${__dirname}/src`,
  entry: 'app.js',
  output: {
    filename: 'bundle.js',
    path: `${__dirname}/dist`,
  },
  module: {
    loaders: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'babel',
        query: {
          presets: ['react', 'es2015'],
        },
      },
    ],
  },
}
~/code/blockai/merkletree$ node --version
v6.0.0

The module exists on the filesystem, etc. but webpack says it can’t resolve the module. Here’s the content of app.js:

import ReactDOM from 'react-dom'
import React from 'react'

const App = () => (
  <p>hello world!</p>
)

ReactDOM.render(
  <App />,
  document.getElementById('app')
)

Author: Fantashit

1 thought on ““ERROR in Entry module not found” for module that exists

  1.   context: `${__dirname}/src`,
      entry: './app.js',

    entry is a module request, app.js will look for a module named app.js in your node_modules

Comments are closed.