2015-08-19 18 views
5

Tôi đang cố gắng thiết lập plugin xác thực aurelia trong dự án của mình. Tôi đang sử dụng VS2015. Tôi đã cài đặt plugin aurelia-validation bằng cách sử dụng lệnh jspm install aurelia-validation.lỗi khi tải plugin aurelia-validation

Tệp Config.js đã được cập nhật "aurelia-validation": "github: aurelia/[email protected]" và trong jspm_packages/github tôi thấy thư mục [email protected]

Tôi đã thêm một plugin trong tệp main.js của mình.

export function configure(aurelia) { 

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

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

và đã thay đổi tôi aurelia ứng dụng để aurelia-app = "main"

Khi tôi bắt đầu ứng dụng tôi nhận được lỗi sau trong Firefox console:

Unhandled promise rejection TypeError: aurelia.globalizeResources is not a function 
Stack trace: 
[email protected]://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 
[email protected]://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 
[email protected]://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 
[email protected]://localhost:15724/jspm_packages/npm/[email protected]/modules/$.task.js:27:7 
[email protected]://localhost:15724/jspm_packages/npm/[email protected]/modules/$.task.js:31:5 

Tôi đã cố gắng xoá bộ nhớ cache jspm với lệnh jspm cc nhưng điều đó không giúp ích gì. Tất cả các gói của tôi đều được cập nhật.

Tôi đang thiếu gì?

Cảm ơn bạn.

Trả lời

6

Có một thay đổi phá vỡ trong Aurelia 0.15.0:

Trong cam kết fix(all): create a property framework configuration object phương pháp globalizeResources được đổi tên thành globalResources

Kể từ đó (2015/08/13) plugin aurelia-xác nhận có không đã được cập nhật.

Bạn gặp lỗi vì xác thực aurelia chỉ hỗ trợ aurelia 0.14.1 trở lên. Vì vậy, bạn phải hạ cấp phiên bản aurelia của mình để làm việc với plugin xác thực cho đến khi nó không được cập nhật.

+0

không chắc chắn nếu nó đã di chuyển cũng - dường như giống như bạn cần làm aurelia.use.globalResources :) –

5

Câu trả lời được chấp nhận là chính xác. Khắc phục nhanh (để tránh hạ cấp aurelia) sẽ tự chỉnh sửa dòng này: https://github.com/aurelia/validation/blob/master/dist/system/index.js#L10

trong thư mục jspm_packages\github\aurelia\validation... bạn

Cũng thay đổi bất kỳ aurelia.withSingleton cuộc gọi đến aurelia.container.registerSingleton

+0

Đây là giải pháp tốt nhất của hai giải pháp. – IWillScoop

Các vấn đề liên quan