Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am using requirejs-backbone to display list of users:However I'm getting this "Uncaught Object" error when i load the page. I debugged it and saw its my main.js that is causing the trouble. Below is my main.js.

 require.config({
   baseUrl: 'scripts/modules/sub-accounts/',
    paths: {

    'underscore': '../../libs/underscore',
    'backbone': '../../libs/backbone',
    'views': 'views',
    'collections': 'collections',
    'models': 'models',
    'templates': 'templates'

},
shim: {
    'underscore': {
        exports: '_'
    },
    'backbone': {
        deps: ['jquery', "underscore"],
        exports: "Backbone"
    },
    'bootstrap': {
        deps: ['jquery']
       }

   }

 });

  require([
       'jquery',
        'underscore',
        'backbone',
         'router'
     ], function ($, _, backbone, router){

  SubAccountRouter.initialize();

});

EDIT:::

This is the place(init.js file) where im initializing all my scripts, apps and other libraries apart from the config in main.js. I'm not sure is that might be causing the issue:

          script : [
            '/scripts/libs/require/require.js',
    '/scripts/libs/require/text.js',
    '/scripts/libs/underscore.js',  
    '/scripts/libs/backbone.js',    
            '/scripts/modules/sub-accounts/main.js',
    '/scripts/modules/sub-accounts/router.js'
          ]

Any ideas as to where i might be going wrong??

share|improve this question
    
Why do you think it’s main.js that’s the problem? On which line does the error happen? –  Buck Doyle May 23 at 23:50
    
The very first line. I tried deleting main.js and router.js and the error goes away. but when i include content in it, throws the error. I put a debugger on the first line: " require.config({ " and it break there with the error: Uncaught object. this is my perception, something else might be going on..I'm clueless though.. –  user2942566 May 24 at 0:24
    
Hmm. Presumably it’s really an error in one of the required files. What if you remove everything in the call to config and build it up step by step? –  Buck Doyle May 24 at 1:07
    
well i happen to try put something like this: require.config({ }); basically removing everything inside the config to see if the paths are causing issue, but no luck...its the same. I'm wondering if its in in my ordering of files: in my init.js i have files loaded: require.js text.js jquery.js and then underscore, backbone.js and so on.. i also tried in the order where jquery.js json.js and then the rest, still no luck..:( any idea?? –  user2942566 May 24 at 4:12
    
Have you tried placing "jquery" into the require.config? Cause since you're not stating it, it's assuming to find "jquery" at 'scripts/modules/sub-accounts/jquery.js'. Is that where it is? Also where is "bootstrap"? I don't see it in the require.config paths –  josephnvu May 24 at 9:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.