当我使用 Angular2 和 Angular-CLI 构建应用程序时,出现一个奇怪的错误。 错误消息是:
themes.js:236 Uncaught TypeError: $.holdReady is not a function
我的 Package.json
{
"name": "app2.0",
"version": "0.0.0",
"license": "MIT",
"scripts": {
// scripts here
},
"private": true,
"dependencies": {
// angular2 packages here
"core-js": "^2.4.1",
"devextreme": "^16.2.5",
"devextreme-angular": "^16.2.5",
"ng2-dropdown-multiselect": "^1.1.1",
"rxjs": "^5.1.0",
"zone.js": "^0.7.6"
},
"devDependencies": {
"@angular/cli": "1.0.0-rc.1",
"@angular/compiler-cli": "^2.4.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.4.2",
"typescript": "~2.0.0"
}
}
最佳答案
devextreme-angular
依赖于 jquery ^3.0.0
根据 jquery 变更日志 https://blog.jquery.com/ 自 3.2.0 起 jQuery.holdReady 已被弃用。
因此,您的解决方案可能会将 jquery 降级至少 3.1.1,例如您可以使用 npm-shrinkwrap.json
来卡住 jquery 版本
关于jquery - Angular cli theme.js 中的奇怪错误 :236 Uncaught TypeError: $.holdReady 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42868638/