[英]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.