Joe
Joe

Reputation: 551

Not able to build reactjs in jenkins pipeline

Its looking strange as I am able to build ReactJS app in local(Ubuntu 20) but jenkins running in same machine throwing build error. Another strange is while login to jenkins user I can build the same successfully. Spent 2 days and now posting here if anybody faced same or has any clue.

chnaged react 16 to 17 & vice versa.

---package.json---

    {
  "name": "myeshopkart",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@capacitor/android": "^2.4.6",
    "@capacitor/cli": "^2.4.6",
    "@capacitor/core": "^2.4.6",
    "@ckeditor/ckeditor5-build-classic": "^27.1.0",
    "@ckeditor/ckeditor5-react": "^3.0.2",
    "@fortawesome/fontawesome-svg-core": "^1.2.34",
    "@fortawesome/react-fontawesome": "^0.1.14",
    "@material-ui/core": "^4.11.3",
    "@material-ui/icons": "^4.11.2",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "axios": "^0.21.1",
    "bootstrap": "^4.6.0",
    "core-js": "^3.6.5",
    "dotenv-cli": "^4.0.0",
    "jquery": "^3.5.1",
    "material-table": "^1.69.2",
    "moment": "^2.29.1",
    "node-sass": "^4.9.0",
    "react": "^16.13.1",
    "react-bootstrap": "^1.0.0",
    "react-combine-reducers": "^1.0.3",
    "react-data-table-component": "^6.11.7",
    "react-datepicker": "^3.3.0",
    "react-dialog": "^1.0.2",
    "react-dom": "^16.13.1",
    "react-error-boundary": "^3.1.1",
    "react-hot-toast": "^2.0.0",
    "react-moment": "^1.1.1",
    "react-redux": "^7.2.1",
    "react-router-dom": "^5.1.2",
    "react-scripts": "3.4.1",
    "redux": "^4.0.5",
    "sass": "^1.32.5",
    "styled-components": "^5.2.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test"
  
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

---error log---

npm verb lifecycle [email protected]~build: unsafe-perm in lifecycle true
npm verb lifecycle [email protected]~build: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/lib/jenkins/workspace/a/eshopkart/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
npm verb lifecycle [email protected]~build: CWD: /var/lib/jenkins/workspace/a/eshopkart
npm sill lifecycle [email protected]~build: Args: [ '-c', 'react-scripts build' ]
npm sill lifecycle [email protected]~build: Returned: code: 1  signal: null
npm info lifecycle [email protected]~build: Failed to exec build script
npm verb stack Error: [email protected] build: `react-scripts build`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
npm verb stack     at EventEmitter.emit (events.js:375:28)
npm verb stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
npm verb stack     at ChildProcess.emit (events.js:375:28)
npm verb stack     at maybeClose (internal/child_process.js:1055:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
npm verb pkgid [email protected]
npm verb cwd /var/lib/jenkins/workspace/a/eshopkart
npm verb Linux 5.4.0-73-generic
npm verb argv "/usr/bin/node" "/usr/bin/npm" "run" "build" "--loglevel" "silly"
npm verb node v14.17.1
npm verb npm  v6.14.13
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
npm timing npm Completed in 254305ms

npm ERR! A complete log of this run can be found in:
npm ERR!     /var/lib/jenkins/.npm/_logs/2021-07-01T05_44_28_123Z-debug.log
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE

Upvotes: 0

Views: 1508

Answers (1)

Joe
Joe

Reputation: 551

I installed new version of jenkins where by default WARN message is treating as ERROR so not able to build. doing CI='' npm run build worked.In older version there was not such issues.

Upvotes: 1

Related Questions