Skip to content

Uncaught ReferenceError: require is not defined followed by Uncaught Error: [$injector:nomod] Module 'app' is not available!  #14

@flyingzumwalt

Description

@flyingzumwalt

Given a working Angular app that's based on the lineman-angular-template with all my tests passing
When I run npm install lineman-browserify --save-dev per instructions in the README
Then I get this error from testem:

Uncaught ReferenceError: require is not defined at http://localhost:7357/generated/js/app.js, line 60674

It's referencing that calls 'window._ = require("underscore")' in this snippet:

(function() {
  window._ = require("underscore");

  require("./hello");

}).call(this);

... so basically browserify isn't actually doing its thing. What am I missing? Is there an undocumented step?

Note: The calls to require() within app/js/endpoint.coffee are being run properly, but somehow this other line which, by the way, is just generated code from within lineman-browserify,

Different error after running lineman clean

For some reason, the original contents of app/js/endpoint.coffee were sticking around in generated/app.js even after I changed the source file so I tried running lineman clean then 'lineman run' This made testem return a new error:

Uncaught Error: [$injector:nomod] Module 'app' is not available! You either misspelled the module name or forgot to load it. If registering a 
module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.2.9/...<omitted>...pp at http://localhost:7357/generated/js/app.js, line 13819

Also Note

I had to run npm install browserify --save-dev in addition to npm install lineman-browserify --save-dev. Otherwise I got an errors like this when I ran lineman run:

Loading "browserify.js" tasks...ERROR
>> Error: Cannot find module 'browserify'

Running "common" task
Warning: Task "browserify" not found. Used --force, continuing.

The README doesn't mention this extra step.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions