Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error when loading aurelia-validation plugin

I am trying to setup aurelia-validation plugin in my project. I am using VS2015. I have installed aurelia-validation plugin using jspm install aurelia-validation command.

Config.js file has been updated "aurelia-validation": "github:aurelia/[email protected]" and in jspm_packages/github I see [email protected] folder.

I have added a plugin in my main.js file.

export function configure(aurelia) {

    aurelia.use
        .standardConfiguration()
        .developmentLogging()
        .plugin('aurelia-validation');

    aurelia.start().then(a => a.setRoot());
}

and have changed my aurelia-app to aurelia-app="main"

When I start the app I get the following error in Firefox console:

Unhandled promise rejection TypeError: aurelia.globalizeResources is not a function
Stack trace:
configure@http://localhost:15724/jspm_packages/github/aurelia/[email protected]/index.js:28:5
loadPlugin/<@http://localhost:15724/jspm_packages/github/aurelia/[email protected]/aurelia-framework.js:34:32
run@http://localhost:15724/jspm_packages/npm/[email protected]/modules/es6.promise.js:91:43
notify/<@http://localhost:15724/jspm_packages/npm/[email protected]/modules/es6.promise.js:105:11
module.exports@http://localhost:15724/jspm_packages/npm/[email protected]/modules/$.invoke.js:6:25
@http://localhost:15724/jspm_packages/npm/[email protected]/modules/$.task.js:40:9
run@http://localhost:15724/jspm_packages/npm/[email protected]/modules/$.task.js:27:7
listner@http://localhost:15724/jspm_packages/npm/[email protected]/modules/$.task.js:31:5

I have tried clearing jspm cache with jspm cc command but that didn't help. All my packages are up to date.

What am I missing?

Thank you.

like image 902
partyelite Avatar asked Aug 19 '15 18:08

partyelite


2 Answers

There was a breaking change in Aurelia 0.15.0:

In the commit fix(all): create a property framework configuration object the globalizeResources method was renamed to globalResources

Since then (2015.08.13) the aurelia-validation plugin hasn't been updated.

You get the error because the aurelia-validation only supports aurelia 0.14.1 or older. So you have to downgrade your aurelia version to work with the validation plugin until it is not updated.

like image 52
nemesv Avatar answered Nov 08 '22 01:11

nemesv


The accepted answer is correct. A quick fix (to avoid downgrading aurelia) would be to manually edit this line: https://github.com/aurelia/validation/blob/master/dist/system/index.js#L10

in your jspm_packages\github\aurelia\validation... folder

Also change any aurelia.withSingleton calls to aurelia.container.registerSingleton

like image 5
Jeremy Danyow Avatar answered Nov 08 '22 03:11

Jeremy Danyow