gpt4 book ai didi

node.js - ionic Cordova 构建类型 'ModuleWithProviders' 不是通用的

转载 作者:行者123 更新时间:2023-12-03 22:52:58 32 4
gpt4 key购买 nike

嗨,我对 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.
我尝试过更新软件包、删除和安装 Node 模块、更新初始化脚本,但没有任何帮助。
这是我的包 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

关于node.js - ionic Cordova 构建类型 'ModuleWithProviders' 不是通用的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63753553/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com