Uncaught TypeError: Object(...) is not a function in the browser
Uncaught TypeError: Object(...) is not a function in the browser
我正在尝试使用 Ionic Image Loader 进行图像加载和缓存。编译的时候没有报错,但是在浏览器中,却显示如下错误。我正在粘贴 package.json 文件中的详细信息。我是 ionic 和 angular 的新手。请让我知道如何解决此问题。
Uncaught TypeError: Object(...) is not a function at index.js:1193
at Module../node_modules/@ionic-native/file/index.js (index.js:1370)
at __webpack_require__ (bootstrap:84) at Module../node_modules/ionic-image-loader/dist/image-loader.module.js (image-loader.module.js:1)
at __webpack_require__ (bootstrap:84) at Module../node_modules/ionic-image-loader/dist/index.js (index.js:1) at __webpack_require__ (bootstrap:84)
at Module../src/app/app-routing.module.ts (main.js:494)
at __webpack_require__ (bootstrap:84)
at Module../src/app/app.module.ts (app.component.ts:12)
我的package.json如下所示
{
"name": "blank",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "~8.1.2",
"@angular/core": "~8.1.2",
"@angular/forms": "~8.1.2",
"@angular/platform-browser": "~8.1.2",
"@angular/platform-browser-dynamic": "~8.1.2",
"@angular/router": "~8.1.2",
"@ionic-native/core": "^5.0.0-beta.14",
"@ionic-native/file": "^4.20.0",
"@ionic-native/file-transfer": "^5.20.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^4.7.1",
"cordova-plugin-file": "6.0.2",
"core-js": "^2.5.4",
"ionic-image-loader": "^6.3.3",
"rxjs": "^6.5.4",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/architect": "~0.801.2",
"@angular-devkit/build-angular": "~0.801.2",
"@angular-devkit/core": "~8.1.2",
"@angular-devkit/schematics": "~8.1.2",
"@angular/cli": "~8.1.2",
"@angular/compiler": "~8.1.2",
"@angular/compiler-cli": "~8.1.2",
"@angular/language-service": "~8.1.2",
"@ionic/angular-toolkit": "^2.1.1",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"jasmine-core": "^3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.4.3"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-file": {}
}
}
}
这很可能是因为版本不匹配。
当前版本 ionic-image-loader
does not yet support v5 of @ionic-native/file
but there is a beta version available which does support it.
确保所有 @ionic-native/*
包都在同一个主要版本上。想用beta版就用v5,否则就用v5和最新稳定版ionic-image-loader
.
我正在尝试使用 Ionic Image Loader 进行图像加载和缓存。编译的时候没有报错,但是在浏览器中,却显示如下错误。我正在粘贴 package.json 文件中的详细信息。我是 ionic 和 angular 的新手。请让我知道如何解决此问题。
Uncaught TypeError: Object(...) is not a function at index.js:1193
at Module../node_modules/@ionic-native/file/index.js (index.js:1370)
at __webpack_require__ (bootstrap:84) at Module../node_modules/ionic-image-loader/dist/image-loader.module.js (image-loader.module.js:1)
at __webpack_require__ (bootstrap:84) at Module../node_modules/ionic-image-loader/dist/index.js (index.js:1) at __webpack_require__ (bootstrap:84)
at Module../src/app/app-routing.module.ts (main.js:494)
at __webpack_require__ (bootstrap:84)
at Module../src/app/app.module.ts (app.component.ts:12)
我的package.json如下所示
{
"name": "blank",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "~8.1.2",
"@angular/core": "~8.1.2",
"@angular/forms": "~8.1.2",
"@angular/platform-browser": "~8.1.2",
"@angular/platform-browser-dynamic": "~8.1.2",
"@angular/router": "~8.1.2",
"@ionic-native/core": "^5.0.0-beta.14",
"@ionic-native/file": "^4.20.0",
"@ionic-native/file-transfer": "^5.20.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^4.7.1",
"cordova-plugin-file": "6.0.2",
"core-js": "^2.5.4",
"ionic-image-loader": "^6.3.3",
"rxjs": "^6.5.4",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/architect": "~0.801.2",
"@angular-devkit/build-angular": "~0.801.2",
"@angular-devkit/core": "~8.1.2",
"@angular-devkit/schematics": "~8.1.2",
"@angular/cli": "~8.1.2",
"@angular/compiler": "~8.1.2",
"@angular/compiler-cli": "~8.1.2",
"@angular/language-service": "~8.1.2",
"@ionic/angular-toolkit": "^2.1.1",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"jasmine-core": "^3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.4.3"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-file": {}
}
}
}
这很可能是因为版本不匹配。
当前版本 ionic-image-loader
does not yet support v5 of @ionic-native/file
but there is a beta version available which does support it.
确保所有 @ionic-native/*
包都在同一个主要版本上。想用beta版就用v5,否则就用v5和最新稳定版ionic-image-loader
.