我正在使用requirejs加载toastr到我的durandal项目并且它给了我以下错误:
另外,我不知道为什么它在错误的位置搜索:
"NetworkError: 404 Not Found - http://localhost:8080/CaseManagementSystem/assets/ui/app/toastr.js?bust=1441970183153"
toastr....0183153
Error: Failed to load routed module (viewmodels/cmsPage). Details: Script error for: toastr
http://requirejs.org/docs/errors.html#scripterror
exception = new Error(error);
system....0183153 (line 100)
Error: Failed to load routed module (viewmodels/cmsPage). Details: Script error for: toastr
http://requirejs.org/docs/errors.html#scripterror
exception = new Error(error);
我的配置是:
requirejs.config({
urlArgs : "bust=" + (new Date()).getTime(),
/*config:{
moment:{
noGlobal:true
}
},*/
paths : {
'text' : '../lib/require/text',
'durandal' : '../lib/durandal/js',
'plugins' : '../lib/durandal/js/plugins',
'transitions' : '../lib/durandal/js/transitions',
'knockout' : '../lib/knockout/knockout-3.1.0',
'knockout.mapping' : '../lib/knockout/knockout.mapping-latest',
'bootstrap' : '../lib/bootstrap/js/bootstrap',
'jquery' : '../lib/jquery/jquery-1.9.1',
'd3' : "../lib/d3/d3",
'lodash' : '../lib/jointjs/lodash',
'underscore' : '../lib/jointjs/lodash',
'backbone' : '../lib/jointjs/backbone',
'moment' : '../lib/moment/moment.min',
'q' : '../lib/q/q',
'watable' : '../lib/watable/js/jquery.watable',
'bootstrapEdit' : '../lib/bootstrap3-editable/js/bootstrap-editable',
'sugar' : '../lib/sugar/sugar-1.4.1-custom.min',
'list': '../lib/list/list',
'bootstrapDatepicker':'../lib/bootstrap-datepicker/js/bootstrap-datepicker',
'keycloak':'http://10.50.33.18:9080/auth/js/keycloak',
toastr: '../lib/toastr/js/toastr'
},
shim : {
'bootstrap' : {
deps : [ 'jquery' ],
exports : 'jQuery'
},
'knockout.mapping' : {
deps : [ 'knockout' ]
},
'q' : {
exports : 'Q'
},
lodash : {
exports : '_'
},
'breeze' : {
deps : [ 'jquery', 'q', 'knockout' ]
},
backbone : {
//These script dependencies should be loaded before loading backbone.js.
deps : [ 'underscore', 'jquery' ],
//Once loaded, use the global 'Backbone' as the module value.
exports : 'Backbone'
},
toastr: {
deps: ['jquery'],
exports: 'toastr'
}
}
});
并在模块中加载如下:
define(
[ 'plugins/router', 'plugins/http', 'knockout','toastr'],
function(router, http, ko,toastr) {
Reference这个问题
答案 0 :(得分:0)
"计算机科学只有两件事:缓存失效和命名事物。" - Phil Karlton(推测)
好像你在这种情况下经历了第一次。