2017-02-27 76 views
1

我在angular2應用程序中使用kendo UI,我已經遵循這個URL http://www.telerik.com/blogs/cooking-with-aspnet-core-and-angular-2的步驟,在瀏覽器中運行應用程序之後,它的工作正常,但是每當我添加Kendo UI之類的kendo UI項目/劍道按鈕我越來越低於錯誤。Kendo UI與Angular-2的錯誤

試圖將@progress的版本與角度匹配但不成功。

有人可以知道這個錯誤嗎?發生因取決於

An unhandled exception occurred while processing the request. Exception: Call to Node module failed with error: Prerendering failed because of error: Error: Cannot find module "@progress/kendo-data-query" at webpackMissingModule (D:\DemoProject\ng2\kui2-aspnetcore\ClientApp\dist\main-server.js:10709:90) at Object. (D:\DemoProject\ng2\kui2-aspnetcore\ClientApp\dist\main-server.js:10709:194) at __webpack_require__ (D:\DemoProject\ng2\kui2-aspnetcore\ClientApp\dist\main-server.js:20:30) at Object. (D:\DemoProject\ng2\kui2-aspnetcore\ClientApp\dist\main-server.js:7664:29) at __webpack_require__ (D:\DemoProject\ng2\kui2-aspnetcore\ClientApp\dist\main-server.js:20:30) at Object. (D:\DemoProject\ng2\kui2-aspnetcore\ClientApp\dist\main-server.js:10766:23) at __webpack_require__ (D:\DemoProject\ng2\kui2-aspnetcore\ClientApp\dist\main-server.js:20:30) at Object._b (D:\DemoProject\ng2\kui2-aspnetcore\ClientApp\dist\main-server.js:11091:21) at __webpack_require__ (D:\DemoProject\ng2\kui2-aspnetcore\ClientApp\dist\main-server.js:20:30) at Object. (D:\DemoProject\ng2\kui2-aspnetcore\ClientApp\dist\main-server.js:10027:28) Current directory is: D:\DemoProject\ng2\kui2-aspnetcore Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance+d__7.MoveNext()

回答

1

此錯誤在其上劍道UI和角度2的版本,我們使用,因此附加我們應該提及/指定依賴,

例如在上面的錯誤kendo UI版本應該是這樣的, 「@ progress/kendo-angular-buttons」:「^ 0.13.1」, 「@ progress/kendo-angular-grid」:「^ 0.10.0」, 「@ progress/kendo-data-query」:「^ 0.3.0」, 「@ telerik/kendo-theme-default」:「^ 1.28.1」,

下面是完整的package.json文件,

{ 
    "name": "Angular2Spa", 
    "version": "0.0.0", 
    "scripts": { 
    "test": "karma start ClientApp/test/karma.conf.js" 
    }, 
    "dependencies": { 
    "@angular/common": "2.0.2", 
    "@angular/compiler": "2.0.2", 
    "@angular/core": "2.0.2", 
    "@angular/forms": "2.0.2", 
    "@angular/http": "2.0.2", 
    "@angular/platform-browser": "2.0.2", 
    "@angular/platform-browser-dynamic": "2.0.2", 
    "@angular/platform-server": "2.0.2", 
    "@angular/router": "3.0.2", 
    "@progress/kendo-angular-buttons": "^0.13.1", 
    "@progress/kendo-angular-grid": "^0.10.0", 
    "@progress/kendo-data-query": "^0.3.0", 
    "@telerik/kendo-theme-default": "^1.28.1", 
    "@types/node": "^6.0.42", 
    "angular2-platform-node": "~2.0.11", 
    "angular2-template-loader": "^0.6.2", 
    "angular2-universal": "~2.0.11", 
    "angular2-universal-patch": "^0.2.1", 
    "angular2-universal-polyfills": "~2.0.11", 
    "aspnet-prerendering": "^2.0.0", 
    "aspnet-webpack": "^1.0.17", 
    "awesome-typescript-loader": "3.0.0-beta.13 || ^3.0.0", 
    "bootstrap": "^3.3.7", 
    "css": "^2.2.1", 
    "css-loader": "^0.25.0", 
    "es6-shim": "^0.35.1", 
    "event-source-polyfill": "^0.0.7", 
    "expose-loader": "^0.7.1", 
    "extract-text-webpack-plugin": "^2.0.0-rc", 
    "file-loader": "^0.9.0", 
    "html-loader": "^0.4.4", 
    "install": "^0.8.7", 
    "isomorphic-fetch": "^2.2.1", 
    "jquery": "^2.2.1", 
    "json-loader": "^0.5.4", 
    "npm": "^4.3.0", 
    "preboot": "^4.5.2", 
    "raw-loader": "^0.5.1", 
    "rxjs": "5.0.0-beta.12", 
    "style-loader": "^0.13.1", 
    "to-string-loader": "^1.1.5", 
    "typescript": "^2.0.3", 
    "url-loader": "^0.5.7", 
    "webpack": "^2.2.0", 
    "webpack-hot-middleware": "^2.12.2", 
    "webpack-merge": "^0.14.1", 
    "zone.js": "^0.6.25" 
    }, 
    "devDependencies": { 
    "@types/chai": "^3.4.34", 
    "@types/jasmine": "^2.5.37", 
    "chai": "^3.5.0", 
    "jasmine-core": "^2.5.2", 
    "karma": "^1.3.0", 
    "karma-chai": "^0.1.0", 
    "karma-chrome-launcher": "^2.0.0", 
    "karma-cli": "^1.0.1", 
    "karma-jasmine": "^1.0.2", 
    "karma-webpack": "^1.8.0" 
    } 
} 

上面的修改解決了我的問題。