Search code examples
javascriptknockout.jsrequirejsforerunnerdb

ENOENT no such file or directory when trying to load ForerunnerDB with requirejs


Hello I am using yo ko a knockout yeoman generator in my application. The application has been scaffold with requirejs and gulp, but I am having trouble adding ForerunnerDB to the require.config for distribution, here is the require.config.js:

//require.js looks for the following global when initializing
var require = {
    baseUrl: ".",
    paths: {
        "bootstrap":            "bower_modules/components-bootstrap/js/bootstrap.min",
        "crossroads":           "bower_modules/crossroads/dist/crossroads.min",
        "hasher":               "bower_modules/hasher/dist/js/hasher.min",
        "jquery":               "bower_modules/jquery/dist/jquery",
        "knockout":             "bower_modules/knockout/dist/knockout",
        "knockout-projections": "bower_modules/knockout-projections/dist/knockout-projections",
        "signals":              "bower_modules/js-signals/dist/signals.min",
        "text":                 "bower_modules/requirejs-text/text",
        'forerunner': 'bower_modules/forerunnerdb/js/dist/fdb-all.min'
    },
    shim: {
        "bootstrap": { deps: ["jquery"] }
    }
};

I am using the gulpfile.js with gulp:serve:dist but I am getting

[Error: Error: ENOENT: no such file or directory, open 'c:...\temp\core.js'

In module tree: app/startup forerunner at Error (native)

But everything is working when I use gulp serve:src. I already tried to add core.js dependencies in the shim, but can not make it work. There is always a file missing .

here is the github repo


Solution

  • For some reason requirejs gets upset in this configuration so the way to solve it is to add ForerunnerDB to your index.html as a separate script, remove all the dependency references to ForerunnerDB in your require.config.js and then modify your gulp default task to concatenate the scripts.js file that gets generated with the fdb-all.min.js file in ForerunnerDB's js/dists folder.

    I have updated the github repo with the changes you have to make as described above. You can see them here: https://github.com/jeanPokou/project_beta/commits/master