角度错误静态解析符号值时遇到

时间:2019-01-19 19:01:00

标签: node.js angular

当我尝试运行npm run server时 我收到错误消息:

ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 64:19 in the original .ts file), resolving symbol AppModule in C:/Users/*****/src/app/app.module.ts

webpack:无法编译。

这是我的app.module.ts的内容:

    import { NgModule, ApplicationRef } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {SharedService} from './shared.service';
import { FormsModule } from '@angular/forms';
import {MaskedInput} from './+front/masked-input.directive';

/*
 * Platform and Environment providers/directives/pipes
 */
import { routing } from './app.routing'
// App is our top level component
import { AppComponent } from './app.component';
import { APP_RESOLVER_PROVIDERS } from './app.resolver';
import { AppState, InternalStateType } from './app.service';

// Core providers
import {CoreModule} from "./core/core.module";
import {SmartadminLayoutModule} from "./shared/layout/layout.module";
import {UrlPermission} from "./UrlPermission/urlPermession";
import {Http, HttpModule, RequestOptions, XHRBackend} from '@angular/http';
import {MyCustomHttp} from './interceptor';
import {AuthService} from './AuthService/AuthService';
// Application wide providers
const APP_PROVIDERS = [
  ...APP_RESOLVER_PROVIDERS,
  AppState
];

type StoreType = {
  state: InternalStateType,
  restoreInputValues: () => void,
  disposeOldHosts: () => void
};

/**
 * `AppModule` is the main entry point into Angular2's bootstraping process
 */
@NgModule({
  bootstrap: [ AppComponent ],
  declarations: [
    AppComponent,
  ],
  imports: [ // import Angular's modules
    BrowserModule,
    BrowserAnimationsModule,
    FormsModule,
    HttpModule,
    CoreModule,
    SmartadminLayoutModule,
    routing
  ],
  exports: [
  ],
  providers: [ // expose our Services and Providers into Angular's dependency injection
    // ENV_PROVIDERS,
    APP_PROVIDERS,
    SharedService,
    UrlPermission,
    AuthService,
    MaskedInput,
     {
      provide: Http,
      useFactory: (backend,options) => new MyCustomHttp(backend, options),
      deps: [XHRBackend, RequestOptions]
    },

  ]
})
export class AppModule {
  constructor(public appRef: ApplicationRef, public appState: AppState) {}


}

我认为这是节点版本问题,因此我将NodeJS从10版本降级为8版本。但是错误总是一样的 在我的旧计算机上工作正常。我不知道应该更改哪些内容或应该录制哪些命令。或我应该如何更改app.module.ts

请帮忙吗? 谢谢

0 个答案:

没有答案