我正在开发有角度的电子应用程序。我无法提供Windows和Linux应用程序的构建。
这是我得到的错误。当我运行以下命令时:npm运行electron:windows
PS D:\trackly\TimeTrackingApp_Electron-master> npm run electron:windows
> Trackly@5.2.5 electron:windows D:\trackly\TimeTrackingApp_Electron-master
> npm run build:prod && npx electron-builder build --windows
> Trackly@5.2.5 build:prod D:\trackly\TimeTrackingApp_Electron-master
> npm run build -- -c production
> Trackly@5.2.5 build D:\trackly\TimeTrackingApp_Electron-master
> npm run postinstall:electron && npm run electron:serve-tsc && ng build "-c" "production"
> Trackly@5.2.5 postinstall:electron D:\trackly\TimeTrackingApp_Electron-master
> node postinstall
> Trackly@5.2.5 electron:serve-tsc D:\trackly\TimeTrackingApp_Electron-master
> tsc -p tsconfig-serve.json
10% building modules 3/3 modules 0 activelooking for undefined provider for the NgModule 'NgxMaterialTimepickerModule in D:/trackly/TimeTrackingApp_Electron-master/node_modules/ngx-material-timepicker/ngx-material-timepicker.d.ts'Date: 2019-01-04T07:50:40.006Z Hash: da67c7a8c12b72458ed5 Time: 13833ms chunk {0} runtime.ec2944dd8b20ec099bf3.js (runtime) 1.41 kB [entry] [rendered] chunk {1} main.9868d9b237c3a48c54da.js (main) 128 bytes [initial] [rendered] chunk {2} polyfills.85f47f0bf59079cbc23a.js (polyfills) 130 bytes [initial] [rendered] chunk {3} styles.b355ced00b1297914fd7.css (styles) 235 kB [initial] [rendered]
ERROR in : Encountered undefined provider! Usually this means you have a circular dependencies. This might be caused by using 'barrel' index.ts files.
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! Trackly@5.2.5 build: `npm run postinstall:electron && npm run electron:serve-tsc && ng build "-c" "production"` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the Trackly@5.2.5 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\ankus\AppData\Roaming\npm-cache\_logs\2019-01-04T07_50_40_079Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! Trackly@5.2.5 build:prod: `npm run build -- -c production` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the Trackly@5.2.5 build:prod script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\ankus\AppData\Roaming\npm-cache\_logs\2019-01-04T07_50_40_145Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! Trackly@5.2.5 electron:windows: `npm run build:prod && npx electron-builder build
--windows` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the Trackly@5.2.5 electron:windows script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\ankus\AppData\Roaming\npm-cache\_logs\2019-01-04T07_50_40_174Z-debug.log
这是我的app.module.ts
import 'zone.js/dist/zone-mix';
import 'reflect-metadata';
import '../polyfills';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, forwardRef } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
// NG Translate import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { ElectronService } from './providers/electron.service';
import { WebviewDirective } from './directives/webview.directive';
import { AppComponent } from './app.component';
import { TaskComponent } from './components/task/task.component';
import { LoginComponent } from './components/login/login.component';
import { AngularFontAwesomeModule } from 'angular-font-awesome';
import { AlertComponent } from './components/_directives/alert/alert.component'; import { AlertService } from './components/_services/alert.service';
import { routing } from './app.routing';
import { AuthGuard } from './components/_guards/auth.guard';
import { TimeConvertPipe } from './components/_pipes/time-convert.pipe';
import { DashboardComponent } from './components/dashboard/dashboard.component'; import { HttpService } from './components/_services/http.service';
import { DataService } from './components/_services/data.service';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { MatMenuModule } from '@angular/material/menu';
import { MatButtonModule } from '@angular/material/button';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatDialogModule } from '@angular/material/dialog';
import { MatIconModule } from '@angular/material/icon';
import { MatRadioModule } from '@angular/material/radio';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatSelectModule } from '@angular/material/select';
import { NgxMaterialTimepickerModule } from 'ngx-material-timepicker';
import { ObjectKeyPipe } from './components/_pipes/object-key.pipe';
import { HelpComponent } from './components/help/help.component';
import { CheckComponent } from './components/check/check.component';
import { NoteComponent } from './components/modals/note/note.component';
import { SettingModalComponent } from './components/modals/setting-modal/setting-modal.component';
import { HeaderComponent } from './components/header/header.component';
// AoT requires an exported function for factories export function HttpLoaderFactory(http: HttpClient) { return new TranslateHttpLoader(http, './assets/i18n/', '.json'); }
@NgModule({
declarations: [
AppComponent,
TaskComponent,
WebviewDirective,
LoginComponent,
AlertComponent,
TimeConvertPipe,
DashboardComponent,
ObjectKeyPipe,
HelpComponent,
CheckComponent,
NoteComponent,
SettingModalComponent,
HeaderComponent
],
providers: [
forwardRef(() => ElectronService),
forwardRef(() => AlertService),
forwardRef(() => AuthGuard),
forwardRef(() => HttpService),
forwardRef(() => DataService),
// ElectronService,
// AlertService,
// AuthGuard,
// HttpService,
// DataService ], imports: [
BrowserModule,
ReactiveFormsModule,
HttpClientModule,
AngularFontAwesomeModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (HttpLoaderFactory),
deps: [HttpClient]
}
}),
routing,
FormsModule,
BrowserAnimationsModule,
MatMenuModule,
MatButtonModule,
MatFormFieldModule,
MatInputModule,
MatToolbarModule,
MatDialogModule,
MatIconModule,
MatRadioModule,
MatCheckboxModule,
MatSelectModule,
forwardRef(() => NgxMaterialTimepickerModule.forRoot())
],
entryComponents: [
NoteComponent,
SettingModalComponent
],
bootstrap: [AppComponent]
})
export class AppModule { }
我尝试将正向引用用于服务,但仍然遇到相同的错误。
这是我的package.json文件:
{
"name": "Trackly",
"version": "5.2.5",
"description": "Time tracking electron application",
"main": "main.js",
"private": true,
"scripts": {
"postinstall": "npm run postinstall:electron && npx electron-builder install-app-deps",
"postinstall:web": "node postinstall-web",
"postinstall:electron": "node postinstall",
"ng": "ng",
"start": "npm run postinstall:electron && npm-run-all -p ng:serve electron:serve",
"build": "npm run postinstall:electron && npm run electron:serve-tsc && ng build",
"build:dev": "npm run build -- -c dev",
"build:prod": "npm run build -- -c production",
"ng:serve": "ng serve",
"ng:serve:web": "npm run postinstall:web && ng serve -o",
"electron:serve-tsc": "tsc -p tsconfig-serve.json",
"electron:serve": "wait-on http-get://localhost:4200/ && npm run electron:serve-tsc && electron . --serve",
"electron:local": "npm run build:prod && electron .",
"electron:linux": "npm run build:prod && npx electron-builder build --linux",
"electron:windows": "npm run build:prod && npx electron-builder build --windows",
"electron:mac": "npm run build:prod && npx electron-builder build --mac",
"test": "npm run postinstall:web && ng test",
"e2e": "npm run postinstall:web && ng e2e",
},
"dependencies": {
"@angular/animations": "^7.0.3",
"@angular/cdk": "^7.0.3",
"@angular/material": "^7.0.3",
"@types/cron": "^1.3.0",
"@types/node-notifier": "0.0.28",
"angular-font-awesome": "^3.1.2",
"bootstrap": "^4.1.3",
"circular-dependency-plugin": "^5.0.2",
"codelyzer": "^4.5.0",
"cron": "^1.5.0",
"font-awesome": "^4.7.0",
"iohook": "^0.2.6",
"jquery": "^3.3.1",
"moment": "^2.22.2",
"ngx-material-timepicker": "^2.11.1",
"node-gyp": "^3.8.0",
"node-notifier": "^5.3.0",
"node-sass": "^4.11.0",
"popper.js": "^1.14.5"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.10.0",
"@angular/cli": "7.0.5",
"@angular/common": "7.0.3",
"@angular/compiler": "7.0.3",
"@angular/compiler-cli": "7.0.3",
"@angular/core": "7.0.3",
"@angular/forms": "7.0.3",
"@angular/http": "7.0.3",
"@angular/language-service": "7.0.3",
"@angular/platform-browser": "7.0.3",
"@angular/platform-browser-dynamic": "7.0.3",
"@angular/router": "7.0.3",
"@ngx-translate/core": "10.0.1",
"@ngx-translate/http-loader": "3.0.1",
"@types/jasmine": "2.8.7",
"@types/jasminewd2": "2.0.3",
"conventional-changelog-cli": "^2.0.11",
"core-js": "2.5.6",
"electron": "^3.0.8",
"electron-builder": "20.28.1",
"electron-reload": "1.2.2",
"jasmine-core": "3.1.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "2.0.2",
"karma-chrome-launcher": "2.2.0",
"karma-coverage-istanbul-reporter": "2.0.0",
"karma-jasmine": "1.1.2",
"karma-jasmine-html-reporter": "1.1.0",
"npm-run-all": "4.1.3",
"npx": "10.2.0",
"protractor": "5.3.2",
"rxjs": "6.3.3",
"ts-node": "6.0.3",
"tslint": "5.10.0",
"typescript": "3.1.6",
"wait-on": "2.1.0",
"webdriver-manager": "12.0.6",
"zone.js": "0.8.26"
}
}