I am trying to use browserify for a small web application, what I would like to achieve is pretty basic: I would like to be able to require('jquery') in my JS code instead of having the dependency linked with a <script> tag in the HTML code.
So, I have this in the first line of my JS file called main.js:
require('jquery'); Then, I start browserify to produce bundle.js:
browserify main.js -o bundle.js Output:
Error: Cannot find module 'jquery' from /home/matias/dev/app/js However, it seems jquery is properly installed:
npm -g list | grep jquery returns [email protected].
Any idea what I am doing wrong ?
EDIT: installing modules 'locally' (without -g option) seems to work with browserify - is it the right way to do ? I would prefer to have it using globally installed modules.