npm run build fails in jenkins pipeline , however works in local STS
See original GitHub issuefrontend-maven-plugin version: 1.12.0
Current Behaviour: when using this plugin to compile it is successful in local, however it fails jenkins pipeline.
**pom.xml configuration **
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.12.0</version>
<configuration>
<workingDirectory>config-react</workingDirectory>
<installDirectory>target</installDirectory>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v13.10.0</nodeVersion>
</configuration>
</execution>
<execution>
<id>npm clean </id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>cache clean --force</arguments>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>npm run build</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<configuration>
<target>
<copy todir="${project.build.directory}/classes/public">
<fileset dir="${project.basedir}/config-react/build"/>
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Log file:
info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/var/lib/jenkins/workspace/config-pipeline/target/node/node',
1 verbose cli '/var/lib/jenkins/workspace/config-pipeline/target/node/node_modules/npm/bin/npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build'
1 verbose cli ]
2 info using npm@6.13.7
3 info using node@v13.10.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle config-react@0.1.0~prebuild: config-react@0.1.0
6 info lifecycle config-react@0.1.0~build: config-react@0.1.0
7 verbose lifecycle config-react@0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle config-react@0.1.0~build: PATH: /var/lib/jenkins/workspace/config-pipeline/target/node/node_modules/npm/node_modules/npm-lifecycl
e/node-gyp-bin:/var/lib/jenkins/workspace/config-pipeline/config-react/node_modules/.bin:/var/lib/jenkins/workspace/config-pipeline/target/node:/opt/
softwares/apache-maven-3.8.1/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:
9 verbose lifecycle config-react@0.1.0~build: CWD: /var/lib/jenkins/workspace/config-pipeline/config-react
10 silly lifecycle config-react@0.1.0~build: Args: [ '-c', 'react-scripts build' ]
11 silly lifecycle config-react@0.1.0~build: Returned: code: 1 signal: null
12 info lifecycle config-react@0.1.0~build: Failed to exec build script
13 verbose stack Error: config-react@0.1.0 build: `react-scripts build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/var/lib/jenkins/workspace/config-pipeline/target/node/node_modules/npm/node_modules/npm-lifecycle/
index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:321:20)
13 verbose stack at ChildProcess.<anonymous> (/var/lib/jenkins/workspace/config-pipeline/target/node/node_modules/npm/node_modules/npm-lifecycle/
lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:321:20)
13 verbose stack at maybeClose (internal/child_process.js:1026:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid config-react@0.1.0
15 verbose cwd /var/lib/jenkins/workspace/config-pipeline/config-react
16 verbose Linux 4.18.0-305.3.1.el8.x86_64
17 verbose argv "/var/lib/jenkins/workspace/config-pipeline/target/node/node" "/var/lib/jenkins/workspace/config-pipeline/target/node/node_modules/np
m/bin/npm-cli.js" "run" "build"
18 verbose node v13.10.0
19 verbose npm v6.13.7
20 error code ELIFECYCLE
21 error errno 1
22 error config-react@0.1.0 build: `react-scripts build`
22 error Exit status 1
23 error Failed at the config-react@0.1.0 build script.
Jenkins Logs:
[INFO] --- frontend-maven-plugin:1.12.0:install-node-and-npm (install node and npm) @ liverpool-configuration ---
[INFO] Installing node version v13.10.0
[INFO] Unpacking /var/lib/jenkins/.m2/repository/com/github/eirslett/node/13.10.0/node-13.10.0-linux-x64.tar.gz into /var/lib/jenkins/workspace/config-pipeline/target/node/tmp
[INFO] Copying node binary from /var/lib/jenkins/workspace/config-pipeline/target/node/tmp/node-v13.10.0-linux-x64/bin/node to /var/lib/jenkins/workspace/config-pipeline/target/node/node
[INFO] Extracting NPM
[INFO] Installed node locally.
[INFO]
[INFO] --- frontend-maven-plugin:1.12.0:npm (npm clean) @ liverpool-configuration ---
[INFO] Running 'npm cache clean --force' in /var/lib/jenkins/workspace/config-pipeline/config-react
[INFO] npm WARN using --force I sure hope you know what you are doing.
[INFO]
[INFO] --- frontend-maven-plugin:1.12.0:npm (npm install) @ liverpool-configuration ---
[INFO] Running 'npm install' in /var/lib/jenkins/workspace/config-pipeline/config-react
[INFO] npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
[INFO] npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
[INFO] npm WARN deprecated har-validator@5.1.5: this library is no longer supported
[INFO] npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
[INFO] npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
[INFO] npm WARN deprecated querystring@0.2.1: The
[INFO] npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
[INFO] npm WARN deprecated querystring@0.2.0: The
[INFO] npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
[INFO] npm WARN deprecated rollup-plugin-babel@4.4.0: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.
[INFO] npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
[INFO] npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
[INFO] npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
[INFO] npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
[INFO] npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
[INFO] npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
[INFO] npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
[INFO] npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
[INFO]
[INFO] > core-js@2.6.12 postinstall /var/lib/jenkins/workspace/config-pipeline/config-react/node_modules/babel-runtime/node_modules/core-js
[INFO] > node -e "try{require('./postinstall')}catch(e){}"
[INFO]
[INFO]
[INFO] > core-js@3.15.2 postinstall /var/lib/jenkins/workspace/config-pipeline/config-react/node_modules/core-js
[INFO] > node -e "try{require('./postinstall')}catch(e){}"
[INFO]
[INFO]
[INFO] > core-js-pure@3.15.2 postinstall /var/lib/jenkins/workspace/config-pipeline/config-react/node_modules/core-js-pure
[INFO] > node -e "try{require('./postinstall')}catch(e){}"
[INFO]
[INFO]
[INFO] > ejs@2.7.4 postinstall /var/lib/jenkins/workspace/config-pipeline/config-react/node_modules/ejs
[INFO] > node ./postinstall.js
[INFO]
[INFO] npm notice created a lockfile as package-lock.json. You should commit this file.
[INFO] npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.3 (node_modules/react-scripts/node_modules/fsevents):
[INFO] npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[INFO] npm WARN notsup Unsupported engine for eslint-utils@3.0.0: wanted: {"node":"^10.0.0 || ^12.0.0 || >= 14.0.0"} (current: {"node":"13.10.0","npm":"6.13.7"})
[INFO] npm WARN notsup Not compatible with your version of node/npm: eslint-utils@3.0.0
[INFO] npm WARN notsup Unsupported engine for postcss@8.3.5: wanted: {"node":"^10 || ^12 || >=14"} (current: {"node":"13.10.0","npm":"6.13.7"})
[INFO] npm WARN notsup Not compatible with your version of node/npm: postcss@8.3.5
[INFO] npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
[INFO] npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[INFO] npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
[INFO] npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[INFO] npm WARN @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.14.5 requires a peer of @babel/core@^7.13.0 but none is installed. You must install peer dependencies yourself.
[INFO] npm WARN tsutils@3.21.0 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
[INFO]
[INFO] added 1920 packages from 841 contributors and audited 1924 packages in 52.015s
[INFO]
[INFO] 143 packages are looking for funding
[INFO] run `npm fund` for details
[INFO]
[INFO] found 5 vulnerabilities (3 moderate, 2 high)
[INFO] run `npm audit fix` to fix them, or `npm audit` for details
[INFO]
[INFO] --- frontend-maven-plugin:1.12.0:npm (npm run build) @ liverpool-configuration ---
[INFO] Running 'npm run build' in /var/lib/jenkins/workspace/config-pipeline/config-react
[INFO]
[INFO] > config-react@0.1.0 build /var/lib/jenkins/workspace/config-pipeline/config-react
[INFO] > react-scripts build
[INFO]
[INFO] Creating an optimized production build...
[INFO]
[INFO] Treating warnings as errors because process.env.CI = true.
[INFO] Most CI servers set it automatically.
[INFO]
[INFO] Failed to compile.
[INFO] npm ERR! code ELIFECYCLE
[INFO] npm ERR! errno 1
[INFO] npm ERR! config-react@0.1.0 build: `react-scripts build`
[INFO] npm ERR! Exit status 1
[INFO] npm ERR!
[INFO] npm ERR! Failed at the config-react@0.1.0 build script.
[INFO] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[INFO]
[INFO] npm ERR! A complete log of this run can be found in:
[INFO] npm ERR! /var/lib/jenkins/.npm/_logs/2021-07-06T11_58_11_996Z-debug.log
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Npm build getting failed in jenkins - Community
When i try to run npm build based pipeline , it was getting failed with java heap memory error. Is there any solution...
Read more >npm install fails in Jenkins pipeline even though I configured ...
When building from Jenkins I see that apparently the npm config file is setup correctly but the installations fails, any clues? Using settings ......
Read more >Building a Spring Boot application in Jenkins (part 1 of ...
In this article, we'll create a simple Spring Boot API application with integration tests, and then build it in a Jenkins pipeline every...
Read more >Why tests pass locally but fail in Jenkins | Object Partners
This is most likely due to cached dependencies on the Jenkins server and the new dependencies didn't have their versions updated. If you...
Read more >Declarative Jenkins Pipelines for AWS | AVM Consulting Blog
Build and deploy your AWS services using AWS CDK and Jenkins ... let's explore how a declarative pipeline works from start to finish....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@eirslett you can not simple say Linux issue and close it, you can help how to resolve this issue. I am facing the same issue after pushing my project code and try to build through jenkins. I spent 4 weeks of my time on POC based on this plugin, now what should I do if its failing to deploy in QA environment.
I don’t think this is a problem with the frontend-maven-plugin. Looks like you’re trying to use Maven 3.8.4 (configured in your build somewhere) but you haven’t installed it on your Jenkins properly?