繁体   English   中英

微风吹拂导致“模块未加载未定义不是函数”错误

[英]Breeze with durandal causing 'module not loaded undefined is not a function' error

加载付款模块后,我收到“无法加载路由模块(付款)。 未定义不是函数错误。 我已经尝试了所有方法,甚至将其回滚到一周前发生的某些提交中,并不断收到相同的错误。 经过大量的故障排除后,我将其追溯到我的数据服务。 我发现,当我删除数据服务中所有对“微风”的引用时,它会按预期加载(尽管当然不起作用)。 如果将“微风”重新添加到“定义”依赖项数组中,则会得到未定义不是函数错误。

我没有更改要求。 config,但是我将其与dataservice的define语句一起粘贴到了下面。

require.config({
    paths: {
        'ko': '../Scripts/knockout-3.1.0',
        'breeze': '../Scripts/breeze.debug',
        'jquery': '../Scripts/jquery-2.1.1',
        'jquery-ui': '../Scripts/jquery-ui-1.11.2',
        'bootstrap': '../Scripts/bootstrap.min',
        'text': '../Scripts/text',
        'require': '../Scripts/require',

        // JS Object Serializer/deserializer.  Handled cyclic objects, efficient stringifying.
        'JSOG': '../Scripts/JSOG',
        'domReady': '../Scripts/domReady',
        'Q': '../Scripts/q',

        // Notifications
        'toastr': '../Scripts/toastr',

        //Durandal
        'durandal': '../Scripts/durandal',
        'plugins': '../Scripts/durandal/plugins',
        'transitions': '../Scripts/durandal/transitions',

        // Lazy-developer date formatting
        'moment': '../Scripts/moment.min'
    },
    map: {
        '*': { 'knockout': 'ko' } // Necessary for Durandal, expects Knockout to be 'knockout', not 'ko'
        //                           Breeze expects 'ko'??
    },
    shim: {
        'bootstrap': {
            deps: ['jquery'], // don't load the bootstrap.js until jquery is loaded
            exports: 'bootstrap'
        },
        'JSOG': {
            exports: 'JSOG'
        }
    }

和我的dataservice的define语句:

define(['ko', 'breeze', 'logger', 'Q', 'constants', 'JSOG'], function (ko,breeze,logger,Q,c,JSOG) {

请帮忙。 我敢肯定这很简单,但是我一直在扯头发。

编辑:根据杰里米的要求,这是堆栈跟踪:

TypeError: undefined is not a function
at proto.initialize     (http://localhost:62418/Scripts/breeze.debug.js:15785:26)
at initializeAdapterInstanceCore (http://localhost:62418/Scripts/breeze.debug.js:1870:14)
at Object.__config.getAdapterInstance (http://localhost:62418/Scripts/breeze.debug.js:1818:14)
at breeze.AbstractDataServiceAdapter.proto.initialize (http://localhost:62418/Scripts/breeze.debug.js:15437:30)
at initializeAdapterInstanceCore (http://localhost:62418/Scripts/breeze.debug.js:1870:14)
at __config.initializeAdapterInstance (http://localhost:62418/Scripts/breeze.debug.js:1791:12)↵    at __objectMap (http://localhost:62418/Scripts/breeze.debug.js:56:27)
at Object.__config.initializeAdapterInstances (http://localhost:62418/Scripts/breeze.debug.js:1765:12)
at http://localhost:62418/Scripts/breeze.debug.js:17358:15
at def (http://localhost:62418/Scripts/breeze.debug.js:10:34)"

即使我重构并摆脱了Durandal和Require js,错误似乎也会发生。 即使加载了Jquery(以及KO和Q),我var $injector = ng.injector(['ng']);var $injector = ng.injector(['ng']);处出错var $injector = ng.injector(['ng']); 显然,即使没有定义angular,它也在尝试加载angular ajax调用。

好像我想通了。 我也在AngularJS中进行一些开发工作,许多月前,我为Chrome安装了AngularJS Batarang扩展。 我已经有一段时间没有使用它了,所以我忘了它。 我禁用了它,关闭并重新打开浏览器,然后-Walla! -一切再次正常。

我猜微风以某种方式检测到在扩展中加载了angular,然后尝试加载$ http,它无法访问,并且一切都崩溃了。 我不知道为什么它只是在昨天才开始发生(也许它已被禁用,并以某种方式再次被意外启用了),但这就是问题所在。 我可以使错误发生或任意消失。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM