Error loading aurelia-validation plugin

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

The Config.js file is updated with "aurelia-validation": "github: aurelia / validation@0.2.7 " and in jspm_packages / github I see the validation@0.2.7. folder

I added the plugin to my main.js.

export function configure(aurelia) { aurelia.use .standardConfiguration() .developmentLogging() .plugin('aurelia-validation'); aurelia.start().then(a => a.setRoot()); } 

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

When I launch the application, I get the following error in the Firefox console:

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

I tried to clear the jspm cache with the jspm cc command, but that didn't help. All my packages are updated.

What am I missing?

Thanks.

+5
source share
2 answers

Aurelia experienced dramatic changes in 0.15.0:

In commit fix (all): create a property infrastructure configuration object the globalizeResources method has been renamed globalResources

Since then (2015.08.13) the aurelia-validation plugin has not been updated.

You get an error because aurelia validation only supports aurelia 0.14.1 or later. Therefore, you need to downgrade your aurelia to work with the validation plugin until it is updated.

+6
source

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

in jspm_packages\github\aurelia\validation...

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

+5
source

All Articles