我是Ionic的新手。我使用extenal librabry GaugesModules(https://github.com/MeetmeLeave/ng-canvas-gauges)制作了一个项目。我可以在没有任何问题的情况下在真实设备中调试项目但是当我尝试编译时using ionic cordova build android --prod
给了我:
错误:导入的/..../node_modules/ng-canvas-gauges/lib/index.d.ts'中出现意外值'GaugesModule' 模块'AppModule在/..../src/app/app.module.ts'。请添加一个 @NgModule注释。
at syntaxError(/.... / node_modules // bundles / compiler.umd.js:1550:34)
at /.... / node_modules // bundles / compiler.umd.js:14504:44
在Array.forEach(native)
在CompileMetadataResolver.getNgModuleMetadata(/.... / node_modules // bundles / compiler.umd.js:14487:49)
addNgModule上的(/.... / node_modules // bundles / compiler.umd.js:23050:58)
> / em / node_modules // bundles / compiler.umd.js:23061:14在Array.forEach(native)
at _createNgModules(/..../ node_modules // bundles / compiler.umd.js:23060:26)
analyzeNgModules上的(/.... / node_modules // bundles / compiler.umd.js:22935:14)
在analyzeAndValidateNgModules(/..../ node_modules // bundles / compiler.umd.js:22945:35)
(为简单起见,我使用/..../作为我的目录)
我的app.module.ts:
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { MyApp } from './app.component';
import { InicioPage } from '../pages/inicio/inicio';
import { MonitorPage} from '../pages/monitor/monitor';
import { InternalPage} from '../pages/internal/internal';
import { HistorialPage } from '../pages/historial/historial';
import { CreditosPage } from '../pages/creditos/creditos';
import { BluetoothSerial } from '@ionic-native/bluetooth-serial';
import { GaugesModule } from 'ng-canvas-gauges/lib';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { IonicStorageModule } from '@ionic/storage';
import { UsuarioProvider } from '../providers/usuario/usuario';
@NgModule({
declarations: [
MyApp,
InicioPage,
MonitorPage,
InternalPage,
HistorialPage,
CreditosPage
],
imports: [
BrowserModule,
GaugesModule,
IonicModule.forRoot(MyApp),
IonicStorageModule.forRoot(),
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
InicioPage,
MonitorPage,
InternalPage,
HistorialPage,
CreditosPage
],
providers: [
StatusBar,
SplashScreen,
BluetoothSerial,
{provide: ErrorHandler, useClass: IonicErrorHandler},
UsuarioProvider
]
})
export class AppModule {}
我的离子信息:
cli packages: (/..../node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 2.1.3
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 3.6.0
System:
Android SDK Tools : 25.2.5
Node : v8.1.4
npm : 5.0.3
OS : Linux 4.13
我正在尝试解决这个问题,但我不知道从哪里开始。我正在阅读一些类似的问题,但解决方法不起作用(例如将"paths": { "@angular/*": ["../node_modules/@angular/*"] }
添加到tsconfig.json
)