Ionic 4 构建错误 - 无法读取未定义的 属性 'getBufferedLength'
Ionic 4 build error - Cannot read property 'getBufferedLength' of undefined
当我尝试 'ionic cordova --prod build android' 时,出现以下错误:
错误:无法读取未定义的 属性 'getBufferedLength'
ANDROID_HOME=/usr/local/Caskroom/android-sdk/4333796 (DEPRECATED)
Failed to run "javac -version", make sure that you have a JDK version 8 installed.
You can get it from the following location:
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Your JAVA_HOME is invalid: /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home
Error: Cannot read property 'getBufferedLength' of undefined
[ERROR] An error occurred while running subprocess cordova.
奇怪的是,当我输入 'javac -version' 时,输出是:
macbook$ javac -version
javac 1.8.0_261
另外,'ionic cordova requirements' 崩溃:
> cordova requirements
Error: Cannot read property 'getBufferedLength' of undefined
我的package.json:
"dependencies": {
"@angular/common": "^7.2.16",
"@angular/core": "^7.2.16",
"@angular/forms": "^7.2.16",
"@angular/http": "^7.2.16",
"@angular/platform-browser": "^7.2.16",
"@angular/platform-browser-dynamic": "^7.2.16",
"@angular/router": "^7.2.16",
"@ionic-native/card-io": "^5.30.0",
"@ionic-native/core": "^5.30.0",
"@ionic-native/facebook": "^5.30.0",
"@ionic-native/fcm": "^5.30.0",
"@ionic-native/firebase": "^5.30.0",
"@ionic-native/qr-scanner": "^5.30.0",
"@ionic-native/splash-screen": "^5.30.0",
"@ionic-native/status-bar": "^5.30.0",
"@ionic-native/stripe": "^5.30.0",
"@ionic/angular": "^4.11.13",
"card.io.cordova.mobilesdk": "2.1.0",
"cordova-browser": "^6.0.0",
"cordova-ios": "5.0.1",
"cordova-plugin-add-swift-support": "2.0.2",
"cordova-plugin-facebook4": "1.7.4",
"cordova-plugin-fcm-with-dependecy-updated": "^3.2.0",
"cordova-plugin-qrscanner": "3.0.1",
"cordova-plugin-stripe": "1.5.3",
"cordova-support-android-plugin": "1.0.1",
"cordova-support-google-services": "1.3.2",
"core-js": "^2.6.12",
"firebase": "7.17.1",
"node-sass": "^4.12.0",
"nodemailer": "^6.4.16",
"rxjs": "^6.6.3",
"tslib": "^1.14.1",
"zone.js": "~0.8.29"
},
"devDependencies": {
"@angular-devkit/architect": "~0.13.8",
"@angular-devkit/build-angular": "~0.13.8",
"@angular-devkit/core": "~7.3.8",
"@angular-devkit/schematics": "~7.3.8",
"@angular/cli": "7.3.9",
"@angular/compiler": "^7.2.16",
"@angular/compiler-cli": "^7.2.16",
"@angular/language-service": "^7.2.16",
"@ionic/angular-toolkit": "~1.5.1",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "^2.0.8",
"@types/node": "~12.0.0",
"codelyzer": "~4.5.0",
"cordova-android": "9.0.0",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^4.1.3",
"cordova-plugin-splashscreen": "^5.0.3",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-whitelist": "^1.3.4",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^5.2.3",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.6",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "^7.0.0",
"ts-node": "~8.3.0",
"tslint": "~5.17.0",
"typescript": "~3.1.6"
}
我花了几个小时试图解决这个问题来构建我的应用程序但没有成功。任何帮助将不胜感激!
所以经过一番研究,我发现了问题所在。我试图将条码扫描仪与 Ionic 模块的 QR 码扫描仪一起使用。那些不兼容。
我所做的是删除条形码扫描仪并将此拉取请求实现到我的二维码模块,以便能够将条形码与二维码模块一起使用:
pull request in QR code module to support barcode
一天结束时一切正常。
当我尝试 'ionic cordova --prod build android' 时,出现以下错误:
错误:无法读取未定义的 属性 'getBufferedLength'
ANDROID_HOME=/usr/local/Caskroom/android-sdk/4333796 (DEPRECATED)
Failed to run "javac -version", make sure that you have a JDK version 8 installed.
You can get it from the following location:
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Your JAVA_HOME is invalid: /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home
Error: Cannot read property 'getBufferedLength' of undefined
[ERROR] An error occurred while running subprocess cordova.
奇怪的是,当我输入 'javac -version' 时,输出是:
macbook$ javac -version
javac 1.8.0_261
另外,'ionic cordova requirements' 崩溃:
> cordova requirements
Error: Cannot read property 'getBufferedLength' of undefined
我的package.json:
"dependencies": {
"@angular/common": "^7.2.16",
"@angular/core": "^7.2.16",
"@angular/forms": "^7.2.16",
"@angular/http": "^7.2.16",
"@angular/platform-browser": "^7.2.16",
"@angular/platform-browser-dynamic": "^7.2.16",
"@angular/router": "^7.2.16",
"@ionic-native/card-io": "^5.30.0",
"@ionic-native/core": "^5.30.0",
"@ionic-native/facebook": "^5.30.0",
"@ionic-native/fcm": "^5.30.0",
"@ionic-native/firebase": "^5.30.0",
"@ionic-native/qr-scanner": "^5.30.0",
"@ionic-native/splash-screen": "^5.30.0",
"@ionic-native/status-bar": "^5.30.0",
"@ionic-native/stripe": "^5.30.0",
"@ionic/angular": "^4.11.13",
"card.io.cordova.mobilesdk": "2.1.0",
"cordova-browser": "^6.0.0",
"cordova-ios": "5.0.1",
"cordova-plugin-add-swift-support": "2.0.2",
"cordova-plugin-facebook4": "1.7.4",
"cordova-plugin-fcm-with-dependecy-updated": "^3.2.0",
"cordova-plugin-qrscanner": "3.0.1",
"cordova-plugin-stripe": "1.5.3",
"cordova-support-android-plugin": "1.0.1",
"cordova-support-google-services": "1.3.2",
"core-js": "^2.6.12",
"firebase": "7.17.1",
"node-sass": "^4.12.0",
"nodemailer": "^6.4.16",
"rxjs": "^6.6.3",
"tslib": "^1.14.1",
"zone.js": "~0.8.29"
},
"devDependencies": {
"@angular-devkit/architect": "~0.13.8",
"@angular-devkit/build-angular": "~0.13.8",
"@angular-devkit/core": "~7.3.8",
"@angular-devkit/schematics": "~7.3.8",
"@angular/cli": "7.3.9",
"@angular/compiler": "^7.2.16",
"@angular/compiler-cli": "^7.2.16",
"@angular/language-service": "^7.2.16",
"@ionic/angular-toolkit": "~1.5.1",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "^2.0.8",
"@types/node": "~12.0.0",
"codelyzer": "~4.5.0",
"cordova-android": "9.0.0",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^4.1.3",
"cordova-plugin-splashscreen": "^5.0.3",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-whitelist": "^1.3.4",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^5.2.3",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.6",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "^7.0.0",
"ts-node": "~8.3.0",
"tslint": "~5.17.0",
"typescript": "~3.1.6"
}
我花了几个小时试图解决这个问题来构建我的应用程序但没有成功。任何帮助将不胜感激!
所以经过一番研究,我发现了问题所在。我试图将条码扫描仪与 Ionic 模块的 QR 码扫描仪一起使用。那些不兼容。
我所做的是删除条形码扫描仪并将此拉取请求实现到我的二维码模块,以便能够将条形码与二维码模块一起使用: pull request in QR code module to support barcode
一天结束时一切正常。