Backbone.js RequireJS+;PhoneGap+;骨干

Backbone.js RequireJS+;PhoneGap+;骨干,backbone.js,cordova,requirejs,jquery-mobile,Backbone.js,Cordova,Requirejs,Jquery Mobile,我对RequireJS给我一些“未捕获的类型错误”有问题,我所拥有的只是基本结构,当我在ripple中测试它时,我经常得到这个 Uncaught TypeError: Cannot call method 'local_data_exist' of undefined 这是我的一个库中的函数 Uncaught TypeError: Cannot read property 'jqmNavigator' of undefined 或者这个 因此,由于错误不一致,它们使我很难调试。不知道以前是

我对RequireJS给我一些“未捕获的类型错误”有问题,我所拥有的只是基本结构,当我在ripple中测试它时,我经常得到这个

Uncaught TypeError: Cannot call method 'local_data_exist' of undefined 
这是我的一个库中的函数

Uncaught TypeError: Cannot read property 'jqmNavigator' of undefined
或者这个

因此,由于错误不一致,它们使我很难调试。不知道以前是否有人面对过这种情况

require.config({
    deps:['main'],
    baseUrl: "js",
    paths:{
        // Pointing to Main possible fix for random undefined
        app: 'main',
        // jQuery
        jquery:'libs/jquery/jquery-1.9.1.min',
        // jQuery Plugin for Dfp
        dfp: 'libs/jquery/jquery.dfp.min',
        // jQuery Mobile framework
        jqm:'libs/jquery.mobile/jquery.mobile-1.3.0.min',
        // Backbone.js library
        Backbone:'libs/Backbone/Backbone',
        // Backbone.js Adapter
        localStorage: 'libs/Backbone/backbone.localStorage',
        // RequireJS plugin
        text:'libs/require/text',
        // RequireJS plugin
        domReady:'libs/require/domReady',
        // underscore library
        underscore:'libs/underscore/underscore',
        // jQuery Mobile plugin for Backbone views navigation
        jqmNavigator:'libs/jquery.mobile/jqmNavigator',
        //TouchSwipe
        touchSwipe: 'libs/jquery/jquery.touchSwipe.min',
        //Moment (Date Plugin)
        moment: 'libs/moment/moment',
        // Language plugin
        lang: 'libs/moment/langs.min',
        // Utility Lib
        utils: './utils'
    },
    shim:{
        Backbone:{
            deps:['underscore', 'jquery'],
            exports:'Backbone'
        },
        app: {
            deps:['jquery','Backbone','underscore'],
            exports: "App"
        },
        underscore:{
            exports:'_'
        },
        dfp : {
            deps:['jquery']
        },
        jqm:{
            deps:['jquery', 'jqm-config', 'jqmNavigator']
        },
        touchSwipe:{
            deps:['jquery']
        },
        lang:{
            deps:['moment']
        },
        utils:{
            deps:['jquery']
        }
    },
    waitSeconds: 200,
    priority: ['jquery']
});

require(['jquery', 'domReady', 'Backbone', 'jqm-router', 'models/ApiModel', 'jqm', 'underscore', 'jqm-config', 'jqmNavigator'],
    function ($, domReady, Backbone, AppRouter, Api) {
        domReady(function(){
            window.Api = Api;
            $(this).router = new AppRouter();
        });
    }
);

发布您的requirejs配置,以便我们可以查看这是否是一个填隙问题,或者其他我将检查依赖循环的内容。包括并运行
xrayquire.showCycles()
。它不是解决循环问题的完美工具,但是它会告诉你是否有循环,以及从哪里开始查找。这个require.config是如何调用的,而其他脚本是如何加载的?是不是像这样的事情似乎更合理,现在就开始尝试@explunitOk这可能会解决这个问题,即使我在包含我的一个插件时仍然会出错。我运行了xrayquire给我一个“混合案例模块可能会冲突:视图/页面/文章列表视图要求“utils”和视图/页面/文章视图要求“utils”