installing webpack globally with npm
<p>I am not familiar to node environment. I ran this on my <code>OSX</code> machine </p>

<pre><code>sudo npm install -g webpack
</code></pre>

<p>it installed successfully there, and outputs on the console</p>

<pre><code>/usr/local/bin/webpack -&gt; /usr/local/lib/node_modules/webpack/bin/webpack.js
</code></pre>

<p>But when I ran the <code>grunt</code> command, which requires <code>require('webpack');</code> in the <code>grunt.js</code> file, then I get this message </p>

<pre><code>Loading "Gruntfile.js" tasks...ERROR
&gt;&gt; Error: Cannot find module 'webpack'
Warning: Task "default" not found. Use --force to continue.
</code></pre>

<p>Then I tried to follow some <code>SO</code> posts and ran <code>npm install</code>. But then running <code>grunt</code> gives me a bunch of errors related to <code>react</code>, <code>react-dom</code>, etc...</p>

<p>Btw, when I first launched the command <code>npm install</code>, I got these warnings </p>

<pre><code>npm WARN react-dom@15.4.1 requires a peer of react@^15.4.1 but none was installed.
npm WARN react-select@1.0.0-beta5 requires a peer of react@^0.14.1 but none was installed.
npm WARN react-select@1.0.0-beta5 requires a peer of react-dom@^0.14.1 but none was installed.
npm WARN react-input-autosize@0.6.13 requires a peer of react@^0.14 || ^15.0.0-rc || ^15.0 but none was installed.
npm WARN grunt-webpack@1.0.18 requires a peer of webpack@1.x but none was installed.
npm WARN webpack-dev-server@1.16.2 requires a peer of webpack@&gt;=1.3.0 &lt;3 but none was installed.
npm WARN webpack-dev-middleware@1.8.4 requires a peer of webpack@1 || ^2.1.0-beta but none was installed.
npm WARN mapapp@1.8.0 No repository field.
npm WARN mapapp@1.8.0 No license field.
</code></pre>

<p>UPDATE : </p>

<p>here's the content of the <code>webpack.config.js</code> file</p>

<pre><code>module.exports = {
    entry : "./app/js/index.js",
    output : {
        path : __dirname + '/app/dist',
        filename : "./mapapp.js",
        publicPath : 'dist/'
    },
    module : {
        loaders : [ {
            test : /\.less$/,
            loader : "style!css!less"
        }, {
            test : /\.css$/,
            loader : "style!css"
        }, {
            test : /\.jsx$/,
            loader : "jsx"
        }, {
            test : /react-typeahead.*$/,
            loader : "jsx"
        }, {
            test : /\.(png|svg|woff|eot|ttf)/,
            loader : 'url-loader?limit=8192'
        } ]
    },
    resolve : {
        alias : {
            react : __dirname + '/node_modules/react',
            underscore : __dirname + '/node_modules/underscore/underscore',
            leaflet : __dirname + '/node_modules/leaflet/dist',
            'bootstrap-css-only' : __dirname
                    + '/node_modules/bootstrap/dist/css',
        }
    }
};
</code></pre>