Skip to content

Error: [$injector:modulerr] Failed to instantiate module app.templates #109

@tipycalFlow

Description

@tipycalFlow

I can't figure out why my karma.conf.js won't generate the templates module.

module.exports = function (config) {
    config.set({
        basePath: '',
        frameworks: [  'jasmine', 'requirejs' ],
        files: [
            { pattern: 'public/scripts/app.js', included: false },
            { pattern: 'public/scripts/*.js', included: false },
            { pattern: 'public/scripts/config.js', included: true },
            { pattern: 'test/test-config.js', included: true },
            { pattern: 'public/views/**/*.*', included: false },
            { pattern: 'public/bower_components/**/*.js', included: false },
            { pattern: 'public/scripts/**/*.js', included: false },
            { pattern: 'public/images/**/*.*', included: false },
            { pattern: 'test/directives/**/*.js', included: false
            }
        ],
        plugins: [
            'karma-coverage',
            'karma-jasmine',
            'karma-ng-html2js-preprocessor',
            'karma-requirejs',
            'karma-junit-reporter',
            'karma-chrome-launcher',
            'karma-script-launcher',
            'karma-phantomjs-launcher'
        ],
        preprocessors: {
            '**/*.html': ['ng-html2js']
        },
        ngHtml2JsPreprocessor: {
            moduleName: 'app.templates'
        }
    });
};

In my spec's beforeEach method, module('app.templates'); gives me the following error:

Error: [$injector:modulerr] Failed to instantiate module app.templates due to:
Error: [$injector:nomod] Module 'app.templates' 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.4.9/$injector/nomod?p0=app.templates

I can see in my log that html files are being processed at the correct paths:

DEBUG [preprocessor.html2js]: Processing "/Users/<app_path>/public/views/workspace/my-workspace.html".

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