2

So I am working through my first aurelia-bundler gulp task. I was following the article here except I declared my file as a gulpfile.js instead of the bundler.js that seems to be setup in his solution (I doubt that will matter). Regardless, when I run gulp bundle I get the following error:

C:\dev\Movies\src\Movies>gulp bundle
[21:13:34] Using gulpfile C:\dev\Movies\src\Movies\gulpfile.js
[21:13:34] Starting 'bundle'...
[21:13:36] 'bundle' errored after 1.68 s
[21:13:36] Error on fetch for aurelia-router.js at file:///C:/dev/Movies/src/Movies/wwwroot/aurelia-router.js
        Loading movies/edit.js
        Error: ENOENT: no such file or directory, open 'C:\dev\Movies\src\Movies
\wwwroot\aurelia-router.js'
    at Error (native)

I am not sure why this would be looking in that location since these libraries are all under the jspm_packages folder. My gulp file is setup as follows:

var gulp = require('gulp');
var bundler = require('aurelia-bundler');

var config = {
    force: true,
    packagePath: '.',
    bundles: {
        "wwwroot/appbundle":{
            includes:[
              'app', 'main', 'about/**', 'movies/**', 'resources/**',
              'aurelia-bootstrapper',
              'aurelia-framework',
              'aurelia-router',
              'aurelia-http-client',
              'aurelia-validation'
            ],
            options:{
                inject: true
            }
        }
    }
};

gulp.task('bundle', function () {
    return bundler.bundle(config);
});

gulp.task('unbundle', function () {
    return bundler.unbundle(config);
});

Any thoughts why this is happening, I even removed all the aurelia libraries from the config and I still get the aurelia-router.js error?!?

1 Answer 1

6

Apparently the config.js file was missing an alias for aurelia-router. Adding the alias below allowed the bundler gulp task to complete as desired:

"aurelia-router": "github:aurelia/[email protected]",
2
  • I found something similar too. It is probably because, originally, your app included router as a dependency of one of the other modules rather than being explicitly added to the app. Therefore the bundler didn't see it as a top level module that could be included. However if you were to run 'jspm install aurelia-router' then this would add it (similar to putting it in the config manually) and it would probably work. I think...
    – shunty
    Commented Nov 19, 2015 at 9:18
  • To anyone else reading this, this means that your Router (or other dependency with similar issue) was not properly added into the JSPM dependencies section. If you are currently using a version of JSPM higher than 10.16.19, you will run into issues with dependencies not being mapped on config.js properly. Something to be aware of. Commented Feb 19, 2016 at 5:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.