DJDMorrison DJDMorrison - 1 year ago 67
AngularJS Question

Argument 'HomeCtrl' is not a function, got undefined after deploying with Meteor-Up

I'm creating a meteor app, using angular templates, and have just deployed it to my server using Meteor-Up. It runs fine on my localhost however on the server I'm receiving the following:

Argument 'HomeCtrl' is not a function, got undefined

My code is (with some replaced with ...):


import angular from 'angular';
import angularMeteor from 'angular-meteor';
import { Controller } from 'angular-ecmascript/module-helpers';
import { Projects } from '/lib/collections';
import faker from 'faker';

export default class HomeCtrl extends Controller {
constructor() {



import angularMeteor from 'angular-meteor';
import 'angular-sanitize';
import 'angular-ui-router';
import angular from 'angular';
import Loader from 'angular-ecmascript/module-loader';
import HomeCtrl from '../controllers/homeCtrl'
import WizardCtrl from '../controllers/wizardCtrl'
import RoutesConfig from '../routes';

const App = 'appName';

angular.module(App, [angularMeteor, 'ui.router']);

new Loader(App)


import { Config } from 'angular-ecmascript/module-helpers';

export default class RoutesConfig extends Config {

configure() {
.state('home', {
url: '/',
templateUrl: 'client/templates/home.html',
controller: 'HomeCtrl as home'


RoutesConfig.$inject = ['$stateProvider', '$urlRouterProvider'];


module.exports = {
servers: {
one: {
host: '...',
username: '...',
// pem:
password: '...'
// or leave blank for authenticate from ssh-agent

"setupMongo": false,

meteor: {
name: 'app-name',
path: '../',
servers: {
one: {}
buildOptions: {
serverOnly: true,
env: {
ROOT_URL: '...',
MONGO_URL: '...'

dockerImage: 'abernix/meteord:base',
deployCheckWaitTime: 60


Is there anything I've missed in deploying or something wrong with the code?

Answer Source

I ended up just reverting back to using standard controller functions rather than using ES6 classes. So the above HomeCtrl would become:

var app = angular.module('home-module', []);

app.controller('homeCtrl', ['$scope', function($scope){


You still need to import it in app.js, however you don't need to load it with the loader.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download