npm run build:prod,hatası“ TS2307:找不到模块”通用ng工具包

时间:2019-04-24 13:12:47

标签: angular npm

我想为seo编辑该网站。 我有一个要使用的名为ng toolkit universal的软件包。

我已按照此链接中的说明安装了它,*

  

我使用ng add @ ng-toolkit / universal --http false

安装了此软件包

运行npm run build: prod

我遇到以下错误-

  src \ app \ app.module.ts(169,7)中的

ERROR:模板编译期间出错   AppModule的内容无法解决   相对于[对象的src / shared / confirm-equal-validator.directive   对象] .. src / app / home / stream-videos / stream-videos.component.ts(3,31):   错误TS2307:找不到模块src / app / services / router.service。   src / app / home / stream-videos / stream-videos.component.ts(5,27):错误   TS2307:找不到模块“ src / app / models / Twchannel”。   src / app / admin / login / login.component.ts(2,32):错误TS2307:无法   查找模块“ src / app / app_classes / globalvariable”。   src / app / admin / login / login.component.ts(3,29):错误TS2307:无法   找到模块“ src / app / services / auth.service”。   src / app / admin / login / login.component.ts(4,27):错误TS2307:无法   找到模块“ src / app / models / loginUser”。   src / app / home / instagram / instagram.component.ts(2,34):错误TS2307:   找不到模块“ src / app / services / instagram.service”。   src / app / home / instagram / instagram.component.ts(3,33):错误TS2307:   找不到模块“ src / app / models / instagramPhotos”。   src / app / home / instagram / instagram.component.ts(5,30):错误TS2307:   找不到模块“ src / app / app.component”。   src / app / home / instagram / instagram.component.ts(6,30):错误TS2307:   找不到模块“ src / app / nav / nav.component”。   src / app / admin / streams-ctrl / streams-ctrl.component.ts(2,32):错误   TS2307:找不到模块“ src / app / services / streams.service”。   src / app / admin / streams-ctrl / streams-ctrl.component.ts(3,25):错误   TS2307:找不到模块“ src / app / models / streams”。   src / app / admin / videos-ctrl / videos-ctrl.component.ts(2,24):错误   TS2307:找不到模块“ src / app / models / videos”。   src / app / admin / videos-ctrl / videos-ctrl.component.ts(3,31):错误   TS2307:找不到模块“ src / app / services / videos.service”。   src / app / home / stream-videos / stream-details / stream-details.component.ts(3,32):   错误TS2307:找不到模块src / app / services / streams.service。   src / app / home / stream-videos / stream-details / stream-details.component.ts(4,25):   错误TS2307:找不到模块'src / app / models / streams'。   src / app / admin / modal / modal.component.ts(10,37):错误TS2307:无法   找到模块“ src / app / models / achievementsAddEdit”。

     

npm错误!代码ELIFECYCLE npm ERR! errno 1 npm错误!未链接@ 0.0.0   build:客户端和服务器捆绑包:ng build --prod && ng run Unchained:server:production npm ERR!退出状态1 npm ERR! npm ERR!   在unchained@0.0.0 build:client-and-server-bundles脚本处失败。   npm ERR! npm可能不是问题。有可能   以上是其他日志记录输出。

     

npm错误!有关此运行的完整日志,请参见:npm ERR!
  C:\ Users \ Zafer.Kirik \ AppData \ Roaming \ npm-cache_logs \ 2019-04-24T12_47_29_290Z-debug.log   npm ERR!代码ELIFECYCLE npm ERR! errno 1 npm错误!未链接@ 0.0.0   build:ssr:npm run build:client-and-server-bundles && npm run compile:server npm错误!退出状态1 npm ERR! npm ERR!失败于   unchained@0.0.0 build:ssr脚本。 npm ERR!这可能不是   NPM的问题。上面可能还有其他日志记录输出。

     

npm错误!有关此运行的完整日志,请参见:npm ERR!
  C:\ Users \ Zafer.Kirik \ AppData \ Roaming \ npm-cache_logs \ 2019-04-24T12_47_29_333Z-debug.log   npm ERR!代码ELIFECYCLE npm ERR! errno 1 npm错误!未链接@ 0.0.0   build:prod:npm run build:ssr npm错误!退出状态1 npm ERR! npm   呃!在unchained@0.0.0 build:prod脚本上失败。 npm ERR!这是   npm可能不是问题。可能还有其他日志记录   上面的输出。

     

npm错误!有关此运行的完整日志,请参见:npm ERR!
  C:\ Users \ Zafer.Kirik \ AppData \ Roaming \ npm-cache_logs \ 2019-04-24T12_47_29_374Z-debug.log   PS D:\ UnchainedRepoClone \ unchained 25032019 \ unchained-9>节点-v   v11.14.0 PS D:\ UnchainedRepoClone \ unchained 25032019 \ unchained-9>   angular -v angular:术语“ angular”未被识别为名称   cmdlet,函数,脚本文件或可操作程序的名称。检查   名称的拼写,或者如果包含路径,请验证路径   是正确的,请尝试ag ain。在第1行:char:1   +角-v   + ~~~~~~~~       + CategoryInfo:ObjectNotFound :(角度:字符串)[],CommandNotFoundException       + FullyQualifiedErrorId:CommandNotFoundException

我的AppModule.ts:

    import { BrowserModule } from '@angular/platform-browser';
    import { NgModule } from '@angular/core';
    import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
    import { AnimateComponent } from './animate/animate.component';
    import { HttpClientModule } from "@angular/common/http";
    import { AppRoutingModule } from './app-routing.module';
    import { AppComponent } from './app.component';
    import { HomeComponent } from './home/home.component';
    import { SliderComponent } from './home/slider/slider.component';
    import { NavComponent } from './nav/nav.component';
    import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
    import { TeamsComponent } from './teams/teams.component';
    import { StreamVideosComponent } from './home/stream-videos/stream-videos.component';
    import { NewsComponent } from './home/news/news.component';
    import { CalendarMinComponent } from './home/news/calendar-min/calendar-min.component';
    import { FixtureComponent } from './fixture/fixture.component';
    import { OurTeamsComponent } from './home/our-teams/our-teams.component';
    import { InstagramComponent } from './home/instagram/instagram.component';

    import { InstagramService } from './services/instagram.service';
    import { GalleryComponent } from './gallery/gallery.component';
    import { FooterComponent } from './footer/footer.component';
    import { PartnersComponent } from './partners/partners.component';
    import { StreamsComponent } from './streams/streams.component';
    import { VideoComponent } from './video/video.component';
    import { AdminComponent } from './admin/admin.component';
    import { LoginComponent } from './admin/login/login.component';
    import { OthernavComponent } from './othernav/othernav.component';
    import { FormsModule, ReactiveFormsModule } from '@angular/forms';
    import { LoginGuard } from './app_classes/login.guard';
    import { AuthService } from './services/auth.service';
    import { JwtHelperService } from '@auth0/angular-jwt';
    import { LeftsidebarComponent } from './admin/leftsidebar/leftsidebar.component';
    import { StreamsCtrlComponent } from './admin/streams-ctrl/streams-ctrl.component';
    import { SafePipe } from './pipe/safe.pipe';
    import { VideosCtrlComponent } from './admin/videos-ctrl/videos-ctrl.component';
    import { StreamDetailsComponent } from './home/stream-videos/stream-details/stream-details.component';
    import { IconControlPipe } from './pipe/iconControl.pipe';
    import { AchievementsComponent } from './achievements/achievements.component';
    import { AchievementsCtrlComponent } from './admin/achievements-ctrl/achievements-ctrl.component';
    import { AchievementsSearchPipe } from './pipe/AchievementsSearch.pipe';
    import { AchievementsFilterByDatePipe } from './pipe/achievementsFilterByDate.pipe';
    import { AchievementsFilterByPrizePipe } from './pipe/achievementsFilterByPrize.pipe';
    import { ModalComponent } from './admin/modal/modal.component';

       import {
       MatButtonModule,
       MatCardModule,
       MatDialogModule,
       MatIconModule, 
       MatMenuModule,
       MatToolbarModule,
       MatAutocompleteModule,
       MatBadgeModule,
       MatBottomSheetModule,
       MatButtonToggleModule,
       MatCheckboxModule,
       MatChipsModule,
       MatStepperModule,
       MatDatepickerModule,
       MatDividerModule,
       MatExpansionModule,
       MatGridListModule,
       MatInputModule,
       MatListModule,
       MatNativeDateModule,
       MatPaginatorModule,
       MatProgressBarModule,
       MatProgressSpinnerModule,
       MatRadioModule,
       MatRippleModule,
       MatSelectModule,
       MatSidenavModule,
       MatSliderModule,
       MatSlideToggleModule,
       MatSnackBarModule,
       MatSortModule,
       MatTableModule,
       MatTabsModule,
       MatTooltipModule,
       MatTreeModule,
    } from '@angular/material';
    import { FileUploadModule } from 'ng2-file-upload';
    import { AchievementsFilterByGamePipe } from './pipe/achievementsFilterByGame.pipe';
    import { IntToactivepassivePipe } from './pipe/intToactivepassive.pipe';
    import { SanitizeHtmlPipe } from './pipe/sanitizeHtml.pipe';
    import { StreamsHomeComponent } from './home/stream-videos/streamsHome/streamsHome.component';
    import { VideosHomeComponent } from './home/stream-videos/videosHome/videosHome.component';
    import { VideoDetailsComponent } from './home/stream-videos/video-details/video-details.component';
    import { VideoOrderByDescPipe } from './pipe/videoOrderByDesc.pipe';
    import { RouterLinkReplacePipe } from './pipe/routerLinkReplace.pipe';
    import { RouterLinkUnReplacePipe } from './pipe/RouterLinkUnReplace.pipe';
    import { TwitchchannelsCtrlComponent } from './admin/twitchchannels-ctrl/twitchchannels-ctrl.component';
    import { ModalfortwitchctrlComponent } from './admin/twitchchannels-ctrl/modalfortwitchctrl/modalfortwitchctrl.component';
    import { TwchannelsGameIdToNameConvertPipe } from './pipe/twchannelsGameIdToNameConvert.pipe';
    import { TwchannelsPlayerIdToNameConvertPipe } from './pipe/twchannelsPlayerIdToNameConvert.pipe';
    import { TwhannelsSearchByUserNamePipe } from './pipe/twhannelsSearchByUserName.pipe';
    import { TwchannelsSearchByIdPipe } from './pipe/twchannelsSearchById.pipe';
    import { UsersCtrlComponent } from './admin/users-ctrl/users-ctrl.component';
    import { ModalforusersctrlComponent } from './admin/users-ctrl/modalforusersctrl/modalforusersctrl.component';
    import { ConfirmEqualValidatorDirective } from 'src/shared/confirm-equal-validator.directive';
    import { A11yModule } from '@angular/cdk/a11y';
    import { CdkStepperModule } from '@angular/cdk/stepper';
    import { CdkTableModule } from '@angular/cdk/table';
    import { CdkTreeModule } from '@angular/cdk/tree';
    import { PortalModule } from '@angular/cdk/portal';
    import { ScrollingModule } from '@angular/cdk/scrolling';
    import { DragDropModule } from '@angular/cdk/drag-drop';

    @NgModule({
       declarations: [
          AppComponent,
          HomeComponent,
          SliderComponent,
          NavComponent,
          TeamsComponent,
          TeamsComponent,
          StreamVideosComponent,
          NewsComponent,
          AnimateComponent,
          CalendarMinComponent,
          FixtureComponent,
          OurTeamsComponent,
          GalleryComponent,
          InstagramComponent,
          FooterComponent,
          PartnersComponent,
          StreamsComponent,
          VideoComponent,
          AdminComponent,
          LoginComponent,
          OthernavComponent,
          LeftsidebarComponent,
          StreamsCtrlComponent,
          VideosCtrlComponent,
          StreamDetailsComponent,
          AchievementsComponent,
          AchievementsCtrlComponent,
          ModalComponent,
          StreamsHomeComponent,
          VideosHomeComponent,
          VideoDetailsComponent,
          TwitchchannelsCtrlComponent,
          ModalfortwitchctrlComponent,
          UsersCtrlComponent,
          ModalforusersctrlComponent,
          SafePipe,
          IconControlPipe,
          AchievementsSearchPipe,
          AchievementsFilterByDatePipe,
          AchievementsFilterByPrizePipe,
          AchievementsFilterByGamePipe,
          IntToactivepassivePipe,
          SanitizeHtmlPipe,
          VideoOrderByDescPipe,
          RouterLinkReplacePipe,
          RouterLinkUnReplacePipe,
          TwchannelsGameIdToNameConvertPipe,
          TwchannelsPlayerIdToNameConvertPipe,
          TwhannelsSearchByUserNamePipe,
          TwchannelsSearchByIdPipe,


          ConfirmEqualValidatorDirective
       ],
       imports: [
          BrowserModule,
          HttpClientModule,
          AppRoutingModule,
          NgbModule,
          BrowserAnimationsModule,
          FormsModule,
          MatToolbarModule,
          MatCardModule,
          MatMenuModule,
          MatIconModule,
          MatButtonModule,
          MatDialogModule,
          FileUploadModule,
          MatAutocompleteModule,
          ReactiveFormsModule,
          A11yModule,
          CdkStepperModule,
          CdkTableModule,
          CdkTreeModule,
          DragDropModule,
          MatAutocompleteModule,
          MatBadgeModule,
          MatBottomSheetModule,
          MatButtonModule,
          MatButtonToggleModule,
          MatCardModule,
          MatCheckboxModule,
          MatChipsModule,
          MatStepperModule,
          MatDatepickerModule,
          MatDialogModule,
          MatDividerModule,
          MatExpansionModule,
          MatGridListModule,
          MatIconModule,
          MatInputModule,
          MatListModule,
          MatMenuModule,
          MatNativeDateModule,
          MatPaginatorModule,
          MatProgressBarModule,
          MatProgressSpinnerModule,
          MatRadioModule,
          MatRippleModule,
          MatSelectModule,
          MatSidenavModule,
          MatSliderModule,
          MatSlideToggleModule,
          MatSnackBarModule,
          MatSortModule,
          MatTableModule,
          MatTabsModule,
          MatToolbarModule,
          MatTooltipModule,
          MatTreeModule,
          PortalModule,
          ScrollingModule
       ],
       exports: [
          A11yModule,
          CdkStepperModule,
          CdkTableModule,
          CdkTreeModule,
          DragDropModule,
          MatAutocompleteModule,
          MatBadgeModule,
          MatBottomSheetModule,
          MatButtonModule,
          MatButtonToggleModule,
          MatCardModule,
          MatCheckboxModule,
          MatChipsModule,
          MatStepperModule,
          MatDatepickerModule,
          MatDialogModule,
          MatDividerModule,
          MatExpansionModule,
          MatGridListModule,
          MatIconModule,
          MatInputModule,
          MatListModule,
          MatMenuModule,
          MatNativeDateModule,
          MatPaginatorModule,
          MatProgressBarModule,
          MatProgressSpinnerModule,
          MatRadioModule,
          MatRippleModule,
          MatSelectModule,
          MatSidenavModule,
          MatSliderModule,
          MatSlideToggleModule,
          MatSnackBarModule,
          MatSortModule,
          MatTableModule,
          MatTabsModule,
          MatToolbarModule,
          MatTooltipModule,
          MatTreeModule,
          PortalModule,
          ScrollingModule,

       ],
       providers: [
          InstagramService,
          LoginGuard,
          AuthService
       ],
       bootstrap: [
          AppComponent
       ],
       entryComponents: [ModalComponent, ModalfortwitchctrlComponent, ModalforusersctrlComponent]
    })

export class AppModule { }

1 个答案:

答案 0 :(得分:0)

您似乎尚未执行以下命令: npm install ,该命令将下载并安装所有必需的模块和依赖项。 (根据日志,缺少模块)

相关问题