Uncaught Error: Script error for: jquery(…)

Uncaught Error: Script error for: jquery(…)

我正在尝试加载需要 jquery 才能工作的插件 jquery.countdown

我在初始化时调用插件时遇到此错误 class:

GET http://localhost:3008/js/jquery.js 404 (Not Found)

require.js:166 Uncaught Error: Script error for: jquery(…)

这是我的起始代码:

    define(function (require) {
    var commons = require('commons'), 
    core = require('core/core_library'),
    $ = require('vendor/jquery'),
    ButtonStatus = require('module-pf/ButtonStatus'),
    Archive = require('module-pf/Archive'),
    Countdown = require('appvendor/jquerycountdown');

    });

所以我开始调查。首先,jquery.countdown 库 os 正确加载,如调试所述:

所以我猜 require 不知道 ose 库的加载顺序。经过一番研究,我发现您可以嵌套依赖项来对它们进行排序:

  define(['commons'], function () {
  require(['vendor/jquery'], function (commons) {

    //Added this for testing by calling jquerycountdown internal funcionality

    require(['appvendor/jquerycountdown'], function (inyectedCountdown) {
      $('#timer').countdown('2020/10/10', function (event) {
        $(this).html(event.strftime('%D days %H:%M:%S'));
      });
    });
  });
});

但我仍然得到同样的错误。我不知道发生了什么,可能 jquery 版本不兼容?我手动添加了那个库。 Jquery 在我的项目中运行良好,但它正在加载两个实例,一个位于 js/jquery (404),第二个位于 vendor/js/jquery (200).

我是这样解决的:

jquerycountdown 库中我们发现了一个定义调用 jquery:

    define([ "jquery" ], factory);

所以我刚刚添加了 vendor/jquery