简体   繁体   English

NullInjectorError: StaticInjectorError(Platform: core)[CompilerFactory] Angular

[英]NullInjectorError: StaticInjectorError(Platform: core)[CompilerFactory] Angular

I have problem with my application.我的申请有问题。 Angular 9.0.5 When i build (ng build --prod) application by Jenkins build pass but artifacts (runned by ie. http-server) are broken. Angular 9.0.5 当我通过 Jenkins 构建通道构建(ng build --prod)应用程序时,但工件(由即 http-server 运行)被破坏。

Show me error:显示错误:

Uncaught NullInjectorError: StaticInjectorError(Platform: core)[CompilerFactory]: 
  NullInjectorError: No provider for CompilerFactory!
    at NullInjector.get (http://localhost:4201/vendor.js:17724:27)
    at resolveToken (http://localhost:4201/vendor.js:32313:24)
    at tryResolveToken (http://localhost:4201/vendor.js:32239:16)
    at StaticInjector.get (http://localhost:4201/vendor.js:32080:20)
    at compileNgModuleFactory__PRE_R3__ (http://localhost:4201/vendor.js:53780:38)
    at PlatformRef.bootstrapModule (http://localhost:4201/vendor.js:54124:16)
    at Module../src/main.ts (http://localhost:4201/main.js:729:77)
    at __webpack_require__ (http://localhost:4201/runtime.js:85:30)
    at Object.0 (http://localhost:4201/main.js:741:18)
    at __webpack_require__ (http://localhost:4201/runtime.js:85:30)

But if i go to THE SAME location on my build machine and do ng build --prod then artifacts are working.但是,如果我 go 到我的构建机器上的相同位置并执行构建 --prod 则工件正在工作。 This is kind of magic for me.这对我来说是一种魔法。 Can anyone help me?谁能帮我?

Ok i resolve issue.好的,我解决了问题。

In my case i was used pnpm as package manager.在我的情况下,我使用pnpm作为 package 经理。 And as dependecy i have non compiled packages (typescript)作为依赖,我有未编译的包(打字稿)

And jenkins have problem with access to that long path ( pnpm use store to solve dependencies)并且 jenkins 无法访问该长路径( pnpm 使用存储解决依赖关系)

When i go to this machine on build workspace ( without cleaning) and run ng build --prod then build was builded correctly artifacts.当我 go 到这台机器上的构建工作区(不清理)并运行ng build --prod然后构建正确构建工件。

SOLUTION 1: Use npm instead of pnpm解决方案 1:使用npm代替pnpm
SOLUTION 2: Not using non-compiled packages (typescript)解决方案 2:不使用非编译包(打字稿)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Angular 9:NullInjectorError:CompilerFactory 没有提供者 - Angular 9 : NullInjectorError: No provider for CompilerFactory StaticInjectorError(平台:核心)[AuthGuardSuperAdmin]:NullInjectorError:AuthGuardSuperAdmin没有提供程序 - StaticInjectorError(Platform: core)[AuthGuardSuperAdmin]: NullInjectorError: No provider for AuthGuardSuperAdmin Angular 6 StaticInjectorError(平台:核心)没有提供者 - Angular 6 StaticInjectorError (Platform: core) No provider for 错误:StaticInjectorError(AppModule)[global]:StaticInjectorError(Platform:core)[global]:NullInjectorError:没有提供全局 - ERROR : StaticInjectorError(AppModule)[global]: StaticInjectorError(Platform: core)[global]: NullInjectorError: No provider for global 角度错误:StaticInjectorError(平台:核心)[e -> t]: - Angular Error : StaticInjectorError (Platform: core)[e -> t]: Angular 测试 - NullInjectorError: StaticInjectorError(DynamicTestModule)[NgxPermissionsDirective -> NgxPermissionsService] - Angular tests - NullInjectorError: StaticInjectorError(DynamicTestModule)[NgxPermissionsDirective -> NgxPermissionsService] Angular 9 - 错误:StaticInjectorError[Http]:StaticInjectorError[Http]:NullInjectorError:没有 Http 提供者 - Angular 9 - Error: StaticInjectorError[Http]: StaticInjectorError[Http]: NullInjectorError: No provider for Http 如何解决 Angular 8 解析器中的“NullInjectorError: StaticInjectorError” - How to troubleshoot 'NullInjectorError: StaticInjectorError' in Angular 8 resolver 在 Angular7 生产版本中获取 StaticInjectorError 和 NullInjectorError - Getting StaticInjectorError & NullInjectorError in Angular7 production build Angular 8:错误:未捕获(承诺):NullInjectorError:StaticInjectorError(AppModule) - Angular 8 : Error: Uncaught (in promise): NullInjectorError: StaticInjectorError(AppModule)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM