Search code examples
gulpbrowserifywatchify

Browserify/Watchify Cannot find module 'waypoints'


I'm just starting with browserify. When it's working it's brilliant. But require()...ing some modules isn't working (by default).

I have this code:

var $ = require("jquery");
var gsap = require('gsap');
var waypoints = require('waypoints');

In the above. jQuery and gsap work and are imported. But waypoints doesn't. When waypoints is included I get the error:

Browserify Error { [Error: Cannot find module 'waypoints' from '/Users/mk/Sites/PROJECTNAME/app/scripts']

This happens with some random other modules too.

All modules installed with npm.

Using the browserify/watchify recipe from this page: https://github.com/gulpjs/gulp/blob/master/docs/recipes/fast-browserify-builds-with-watchify.md

I have tried some fixes inspired by similar stack overflow questions but no luck so far.

Some answers suggest that there's is/was a bug with npm that might be responsible. If that's the case is there anything reliable I can do?

Happy to provide further info.


Solution

  • It's issue

    Link to thread https://github.com/imakewebthings/waypoints/issues/458

    use

    require('waypoints/lib/noframework.waypoints.js')