Angular 4 build using pom.xml with jenkins on linux box
Versions Angular CLI: 1.6.3 Node: 6.10.2 OS: win32 x64 Angular:
Repro steps We are running the Angular 4 build using pom.xml with jenkins on linux box. The below issue we did not noticed when we ran it through our local STS. When trying in jenkins only we are facing this issue.
Attached the POM.xml and package.json file for your verfication.
Observed behavior
[ERROR] [ERROR] ERROR in ./src/main.ts [ERROR] Module not found:
Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in
'/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/src'
[ERROR] resolve './$$_gendir/app/app.module.ngfactory' in
'/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/src'
[ERROR] using description file:
/home/jenkins/workspace/DXCSampleAngular4JenkinsProject/angular/package.json
(relative path: ./src) [ERROR] Field 'browser' doesn't contain a
valid alias configuration [ERROR] after using description file:
/home/jenkins/workspace/DXCSampleAngular4JenkinsProject/angular/package.json
(relative path: ./src) [ERROR] using description file:
/home/jenkins/workspace/DXCSampleAngular4JenkinsProject/angular/package.json
(relative path: ./src/$$_gendir/app/app.module.ngfactory) [ERROR]
no extension [ERROR] Field 'browser' doesn't contain a valid
alias configuration [ERROR]
/home/jenkins/workspace/DXCSampleAngular4JenkinsProject/angular/src/$$_gendir/app/app.module.ngfactory
doesn't exist [ERROR] .ts [ERROR] Field 'browser'
doesn't contain a valid alias configuration [ERROR]
/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/src/$$_gendir/app/app.module.ngfactory.ts
doesn't exist [ERROR] .js [ERROR] Field 'browser'
doesn't contain a valid alias configuration [ERROR]
/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/src/$$_gendir/app/app.module.ngfactory.js
doesn't exist [ERROR] as directory [ERROR]
/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/src/$$_gendir/app/app.module.ngfactory
doesn't exist [ERROR]
[/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/src/$$_gendir/app/app.module.ngfactory]
[ERROR]
[/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/src/$$_gendir/app/app.module.ngfactory.ts]
[ERROR]
[/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/src/$$_gendir/app/app.module.ngfactory.js]
[ERROR]
[/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/src/$$_gendir/app/app.module.ngfactory]
[ERROR] @ ./src/main.ts 3:0-74 [ERROR] @ multi ./src/main.ts [ERROR]
ERROR in Error: Error encountered resolving symbol values statically.
Could not resolve ./components/userprofile/userProfile.component
relative to
/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/src/app/app.routing.module.ts.,
resolving symbol AppRoutingModule in
/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/src/app/app.routing.module.ts,
resolving symbol AppRoutingModule in
/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/src/app/app.routing.module.ts,
resolving symbol AppRoutingModule in
/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/src/app/app.routing.module.ts
[ERROR] at Error (native) [ERROR] at syntaxError
(/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/node_modules/@angular/compiler/bundles/compiler.umd.js:1729:34)
[ERROR] at simplifyInContext
(/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/node_modules/@angular/compiler/bundles/compiler.umd.js:24979:23)
[ERROR] at StaticReflector.simplify
(/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/node_modules/@angular/compiler/bundles/compiler.umd.js:24991:13)
[ERROR] at StaticReflector.annotations
(/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/node_modules/@angular/compiler/bundles/compiler.umd.js:24418:41)
[ERROR] at NgModuleResolver.resolve
(/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/node_modules/@angular/compiler/bundles/compiler.umd.js:14750:70)
[ERROR] at CompileMetadataResolver.getNgModuleMetadata
(/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/node_modules/@angular/compiler/bundles/compiler.umd.js:15402:60)
[ERROR] at addNgModule
(/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/node_modules/@angular/compiler/bundles/compiler.umd.js:24268:58)
[ERROR] at
/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/node_modules/@angular/compiler/bundles/compiler.umd.js:24279:14
[ERROR] at Array.forEach (native) [ERROR] at _createNgModules
(/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/node_modules/@angular/compiler/bundles/compiler.umd.js:24278:26)
[ERROR] at analyzeNgModules
(/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/node_modules/@angular/compiler/bundles/compiler.umd.js:24153:14)
[ERROR] at analyzeAndValidateNgModules
(/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/node_modules/@angular/compiler/bundles/compiler.umd.js:24163:35)
[ERROR] at AotCompiler.analyzeModulesAsync
(/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/node_modules/@angular/compiler/bundles/compiler.umd.js:23797:46)
[ERROR] at CodeGenerator.codegen
(/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/node_modules/@angular/compiler-cli/src/codegen.js:32:14)
[ERROR] at Function.NgTools_InternalApi_NG_2.codeGen
(/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/node_modules/@angular/compiler-cli/src/ngtools_api.js:73:30)
[ERROR] [ERROR] npm ERR! Linux 3.10.0-693.2.1.el7.x86_64 [ERROR] npm
ERR! argv
"/home/jenkins/workspace/SampleAngular4JenkinsProject/temp/node/node"
"/home/jenkins/workspace/SampleAngular4JenkinsProject/temp/node/node_modules/npm/bin/npm-cli.js"
"run" "build" [ERROR] npm ERR! node v6.11.2 [ERROR] npm ERR! npm
v3.10.9 [ERROR] npm ERR! code ELIFECYCLE [ERROR] npm ERR!
[email protected] build: `ng build --prod
--base-href=/SampleAngular4App/ --deploy-url=/SampleAngular4App` [ERROR] npm ERR! Exit status 1 [ERROR] npm ERR! [ERROR] npm ERR!
Failed at the [email protected] build script 'ng build --prod
--base-href=/SampleAngular4App/ --deploy-url=/SampleAngular4App'. [ERROR] npm ERR! Make sure you have the latest version of node.js and
npm installed. [ERROR] npm ERR! If you do, this is most likely a
problem with the dxcmodernization-app package, [ERROR] npm ERR! not
with npm itself. [ERROR] npm ERR! Tell the author that this fails on
your system: [ERROR] npm ERR! ng build --prod
--base-href=/SampleAngular4App/ --deploy-url=/SampleAngular4App [ERROR] npm ERR! You can get information on how to open an issue for
this project with: [ERROR] npm ERR! npm bugs dxcmodernization-app
[ERROR] npm ERR! Or if that isn't available, you can get their info
via: [ERROR] npm ERR! npm owner ls dxcmodernization-app [ERROR]
npm ERR! There is likely additional logging output above. [ERROR]
[ERROR] npm ERR! Please include the following file with any support
request: [ERROR] npm ERR!
/home/jenkins/workspace/SampleAngular4JenkinsProject/angular/npm-debug.log
[INFO]
------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO]
------------------------------------------------------------------------ [INFO] Total time: 05:59 min [INFO] Finished at: 2018-01-31T13:18:37Z
[INFO] Final Memory: 14M/241M [INFO]
------------------------------------------------------------------------ [ERROR] Failed to execute goal
com.github.eirslett:frontend-maven-plugin:1.0:npm strong text(npm
build) on project dxcstudiowebapp: Failed to run task: 'npm run build'
failed. (error code 1) - [Help 1] [ERROR] [ERROR] To see the full
stack trace of the errors, re-run Maven with the -e switch. [ERROR]
Re-run Maven using the -X switch to enable full debug logging. [ERROR]
[ERROR] For more information about the errors and possible solutions,
please read the following articles: [ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Desired behavior
The build should be successful, when run through Jenkins as well Attached the files for your reference. Please let us know, how to resolve this issue.
Note: We had tried to getting some answers in the Stackoverflow, but no reply yet.
https://stackoverflow.com/questions/48544806/angular-4-build-using-pom-xml-with-jenkins-on-linux-box
Hello, we reviewed this issue and determined that it doesn't fall into the bug report or feature request category. This issue tracker is not suitable for support requests, please repost your issue on StackOverflow using tag angular-cli.
If you are wondering why we don't resolve support issues via the issue tracker, please check out this explanation.
If I had to bet, the main error message is:
[ERROR] @ ./src/main.ts 3:0-74 [ERROR] @ multi ./src/main.ts
[ERROR] ERROR in Error: Error encountered resolving symbol values statically.
Could not resolve ./components/userprofile/userProfile.component
relative to /home/jenkins/workspace/SampleAngular4JenkinsProject/angular/src/app/app.routing.module.ts.,
Maybe you have some imports with wrong casing. Different OSs have different rules for what they accept in system paths, some are case sensitive and some are not. That might explain why it works on some machines but not on others.
Yes @filipesilva, you are correct because of the camelcase, the error was thrown. The linux environment will check case very carefully, so now i'm changing the component filenames and image names which are in camel case to the normal small case.
Thanks for your valuable input.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.