Ionic cordova build Type 'ModuleWithProviders' 不是通用的
Ionic cordova build Type 'ModuleWithProviders' is not generic
嗨,我对 Angular 不是很有经验,找不到解决方案 -
我正在处理一个 Ionic Cordova 项目,我想更新 Android API 级别。
在那之后,我无法使用命令
构建我的代码
ionic cordova build --release android
> ionic-app-scripts.cmd build --target cordova --platform android
[14:39:13] ionic-app-scripts 3.2.4
[14:39:13] build dev started ...
[14:39:13] clean started ...
[14:39:13] clean finished in 18 ms
[14:39:13] copy started ...
[14:39:13] deeplinks started ...
[14:39:13] deeplinks finished in 337 ms
[14:39:13] transpile started ...
[14:39:20] typescript: {PROJECT_ROOT}/node_modules/@ionic/storage/index.d.ts, line: 5
Type 'ModuleWithProviders' is not generic.
L4: export declare class IonicStorageModule {
L5: static forRoot(storageConfig?: StorageConfig): ModuleWithProviders<IonicStorageModule>;
[14:39:20] typescript: {PROJECT_ROOT}/node_modules/@ionic/storage/storage.d.ts, line: 113
An accessor cannot be declared in an ambient context.
L112: get driver(): string | null;
L114: * Reflect the readiness of the store.
[14:39:20] ionic-app-script task: "build"
[14:39:20] Error: Failed to transpile program
Error: Failed to transpile program
at new BuildError ({PROJECT_ROOT}\node_modules\@ionic\app-scripts\dist\util\errors.js:16:28)
at {PROJECT_ROOT}\node_modules\@ionic\app-scripts\dist\transpile.js:159:20
at new Promise (<anonymous>)
at transpileWorker ({PROJECT_ROOT}\node_modules\@ionic\app-scripts\dist\transpile.js:107:12)
at Object.transpile ({PROJECT_ROOT}\node_modules\@ionic\app-scripts\dist\transpile.js:64:12)
at {PROJECT_ROOT}\node_modules\@ionic\app-scripts\dist\build.js:109:82
[ERROR] An error occurred while running subprocess ionic-app-scripts.
ionic-app-scripts.cmd build --target cordova --platform android exited with exit code 1.
我试过更新包、删除和安装节点模块、更新初始化脚本,但没有任何帮助。
这是我的包裹json
{
"name": "{}",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/animations": "5.2.11",
"@angular/common": "5.2.11",
"@angular/compiler": "5.2.11",
"@angular/compiler-cli": "5.2.11",
"@angular/core": "5.2.11",
"@angular/forms": "5.2.11",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"@ionic-native/core": "^4.20.0",
"@ionic-native/firebase": "^4.20.0",
"@ionic-native/keyboard": "^4.20.0",
"@ionic-native/push": "^4.20.0",
"@ionic-native/splash-screen": "4.9.1",
"@ionic-native/status-bar": "4.9.1",
"@ionic/storage": "^2.3.1",
"cordova-android": "^8.1.0",
"cordova-ios": "^4.5.5",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^1.2.1",
"cordova-plugin-sms-receiver": "0.1.6",
"cordova-plugin-splashscreen": "^5.0.4",
"cordova-plugin-whitelist": "^1.3.4",
"ionic": "^5.4.16",
"ionic-angular": "3.9.2",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"phonegap-plugin-push": "^2.3.0",
"rxjs": "5.5.11",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
},
"devDependencies": {
"@ionic/app-scripts": "^3.2.4",
"typescript": "~2.6.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {},
"phonegap-plugin-push": {
"FCM_VERSION": "11.6.2"
},
"cordova-plugin-sms-receive": {},
"cordova-plugin-sms-receiver": {}
},
"platforms": [
"android"
]
}
}
有人可以帮我吗?
您的 Angular 和 Ionic 依赖项有些旧,需要更新。
由于 @ionic/storage
使用的是最新的依赖项,因此存在冲突,您的应用无法编译它。
您可以尝试将版本降到v2.2.0或更低版本再试。
npm i @ionic/storage@2.2.0 --save
嗨,我对 Angular 不是很有经验,找不到解决方案 - 我正在处理一个 Ionic Cordova 项目,我想更新 Android API 级别。 在那之后,我无法使用命令
构建我的代码ionic cordova build --release android
> ionic-app-scripts.cmd build --target cordova --platform android
[14:39:13] ionic-app-scripts 3.2.4
[14:39:13] build dev started ...
[14:39:13] clean started ...
[14:39:13] clean finished in 18 ms
[14:39:13] copy started ...
[14:39:13] deeplinks started ...
[14:39:13] deeplinks finished in 337 ms
[14:39:13] transpile started ...
[14:39:20] typescript: {PROJECT_ROOT}/node_modules/@ionic/storage/index.d.ts, line: 5
Type 'ModuleWithProviders' is not generic.
L4: export declare class IonicStorageModule {
L5: static forRoot(storageConfig?: StorageConfig): ModuleWithProviders<IonicStorageModule>;
[14:39:20] typescript: {PROJECT_ROOT}/node_modules/@ionic/storage/storage.d.ts, line: 113
An accessor cannot be declared in an ambient context.
L112: get driver(): string | null;
L114: * Reflect the readiness of the store.
[14:39:20] ionic-app-script task: "build"
[14:39:20] Error: Failed to transpile program
Error: Failed to transpile program
at new BuildError ({PROJECT_ROOT}\node_modules\@ionic\app-scripts\dist\util\errors.js:16:28)
at {PROJECT_ROOT}\node_modules\@ionic\app-scripts\dist\transpile.js:159:20
at new Promise (<anonymous>)
at transpileWorker ({PROJECT_ROOT}\node_modules\@ionic\app-scripts\dist\transpile.js:107:12)
at Object.transpile ({PROJECT_ROOT}\node_modules\@ionic\app-scripts\dist\transpile.js:64:12)
at {PROJECT_ROOT}\node_modules\@ionic\app-scripts\dist\build.js:109:82
[ERROR] An error occurred while running subprocess ionic-app-scripts.
ionic-app-scripts.cmd build --target cordova --platform android exited with exit code 1.
我试过更新包、删除和安装节点模块、更新初始化脚本,但没有任何帮助。
这是我的包裹json
{
"name": "{}",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/animations": "5.2.11",
"@angular/common": "5.2.11",
"@angular/compiler": "5.2.11",
"@angular/compiler-cli": "5.2.11",
"@angular/core": "5.2.11",
"@angular/forms": "5.2.11",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"@ionic-native/core": "^4.20.0",
"@ionic-native/firebase": "^4.20.0",
"@ionic-native/keyboard": "^4.20.0",
"@ionic-native/push": "^4.20.0",
"@ionic-native/splash-screen": "4.9.1",
"@ionic-native/status-bar": "4.9.1",
"@ionic/storage": "^2.3.1",
"cordova-android": "^8.1.0",
"cordova-ios": "^4.5.5",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^1.2.1",
"cordova-plugin-sms-receiver": "0.1.6",
"cordova-plugin-splashscreen": "^5.0.4",
"cordova-plugin-whitelist": "^1.3.4",
"ionic": "^5.4.16",
"ionic-angular": "3.9.2",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"phonegap-plugin-push": "^2.3.0",
"rxjs": "5.5.11",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
},
"devDependencies": {
"@ionic/app-scripts": "^3.2.4",
"typescript": "~2.6.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {},
"phonegap-plugin-push": {
"FCM_VERSION": "11.6.2"
},
"cordova-plugin-sms-receive": {},
"cordova-plugin-sms-receiver": {}
},
"platforms": [
"android"
]
}
}
有人可以帮我吗?
您的 Angular 和 Ionic 依赖项有些旧,需要更新。
由于 @ionic/storage
使用的是最新的依赖项,因此存在冲突,您的应用无法编译它。
您可以尝试将版本降到v2.2.0或更低版本再试。
npm i @ionic/storage@2.2.0 --save