Jenkins NPM build failed

Jenkins setup:jenkins version 2.817
NPM :9.6
node:v14.0.0

Getting below error .
C:\Jenkins\workspace\Swift_IM_UI_UAT>npm install
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient…
npm WARN old lockfile
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘@angular-devkit/architect@0.1102.12’,
npm WARN EBADENGINE required: { node: ‘>= 10.13.0’, npm: ‘^6.11.0 || ^7.5.6’, yarn: ‘>= 1.13.0’ },
npm WARN EBADENGINE current: { node: ‘v18.0.0’, npm: ‘8.6.0’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘@angular-devkit/build-angular@0.1102.12’,
npm WARN EBADENGINE required: { node: ‘>= 10.13.0’, npm: ‘^6.11.0 || ^7.5.6’, yarn: ‘>= 1.13.0’ },
npm WARN EBADENGINE current: { node: ‘v18.0.0’, npm: ‘8.6.0’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘@angular-devkit/build-optimizer@0.1102.12’,
npm WARN EBADENGINE required: { node: ‘>= 10.13.0’, npm: ‘^6.11.0 || ^7.5.6’, yarn: ‘>= 1.13.0’ },
npm WARN EBADENGINE current: { node: ‘v18.0.0’, npm: ‘8.6.0’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘@angular-devkit/build-webpack@0.1102.12’,
npm WARN EBADENGINE required: { node: ‘>= 10.13.0’, npm: ‘^6.11.0 || ^7.5.6’, yarn: ‘>= 1.13.0’ },
npm WARN EBADENGINE current: { node: ‘v18.0.0’, npm: ‘8.6.0’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘@angular-devkit/core@11.2.12’,
npm WARN EBADENGINE required: { node: ‘>= 10.13.0’, npm: ‘^6.11.0 || ^7.5.6’, yarn: ‘>= 1.13.0’ },
npm WARN EBADENGINE current: { node: ‘v18.0.0’, npm: ‘8.6.0’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘@angular-devkit/schematics@11.2.11’,
npm WARN EBADENGINE required: { node: ‘>= 10.13.0’, npm: ‘^6.11.0 || ^7.5.6’, yarn: ‘>= 1.13.0’ },
npm WARN EBADENGINE current: { node: ‘v18.0.0’, npm: ‘8.6.0’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘@angular-devkit/core@11.2.11’,
npm WARN EBADENGINE required: { node: ‘>= 10.13.0’, npm: ‘^6.11.0 || ^7.5.6’, yarn: ‘>= 1.13.0’ },
npm WARN EBADENGINE current: { node: ‘v18.0.0’, npm: ‘8.6.0’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘@angular/cli@11.2.11’,
npm WARN EBADENGINE required: { node: ‘>= 10.13.0’, npm: ‘^6.11.0 || ^7.5.6’, yarn: ‘>= 1.13.0’ },
npm WARN EBADENGINE current: { node: ‘v18.0.0’, npm: ‘8.6.0’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘@angular-devkit/architect@0.1102.11’,
npm WARN EBADENGINE required: { node: ‘>= 10.13.0’, npm: ‘^6.11.0 || ^7.5.6’, yarn: ‘>= 1.13.0’ },
npm WARN EBADENGINE current: { node: ‘v18.0.0’, npm: ‘8.6.0’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘@angular-devkit/core@11.2.11’,
npm WARN EBADENGINE required: { node: ‘>= 10.13.0’, npm: ‘^6.11.0 || ^7.5.6’, yarn: ‘>= 1.13.0’ },
npm WARN EBADENGINE current: { node: ‘v18.0.0’, npm: ‘8.6.0’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘@ngtools/webpack@11.2.12’,
npm WARN EBADENGINE required: { node: ‘>= 10.13.0’, npm: ‘^6.11.0 || ^7.5.6’, yarn: ‘>= 1.13.0’ },
npm WARN EBADENGINE current: { node: ‘v18.0.0’, npm: ‘8.6.0’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘@schematics/angular@11.2.11’,
npm WARN EBADENGINE required: { node: ‘>= 10.13.0’, npm: ‘^6.11.0 || ^7.5.6’, yarn: ‘>= 1.13.0’ },
npm WARN EBADENGINE current: { node: ‘v18.0.0’, npm: ‘8.6.0’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘@angular-devkit/core@11.2.11’,
npm WARN EBADENGINE required: { node: ‘>= 10.13.0’, npm: ‘^6.11.0 || ^7.5.6’, yarn: ‘>= 1.13.0’ },
npm WARN EBADENGINE current: { node: ‘v18.0.0’, npm: ‘8.6.0’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘@schematics/update@0.1102.11’,
npm WARN EBADENGINE required: { node: ‘>= 10.13.0’, npm: ‘^6.11.0 || ^7.5.6’, yarn: ‘>= 1.13.0’ },
npm WARN EBADENGINE current: { node: ‘v18.0.0’, npm: ‘8.6.0’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘@angular-devkit/core@11.2.11’,
npm WARN EBADENGINE required: { node: ‘>= 10.13.0’, npm: ‘^6.11.0 || ^7.5.6’, yarn: ‘>= 1.13.0’ },
npm WARN EBADENGINE current: { node: ‘v18.0.0’, npm: ‘8.6.0’ }
npm WARN EBADENGINE }
npm WARN deprecated ini@1.3.5: Please update to ini >=1.3.6 to avoid a prototype pollution issue
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated @npmcli/ci-detect@1.3.0: this package has been deprecated, use ci-info instead
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: Array.prototype.sort() - JavaScript | MDN
npm WARN deprecated source-map-url@0.4.1: See GitHub - lydell/source-map-url: [DEPRECATED] Tools for working with sourceMappingURL comments.
npm WARN deprecated source-map-resolve@0.6.0: See GitHub - lydell/source-map-resolve: [DEPRECATED] Resolve the source map and/or sources for a generated file.
npm WARN deprecated source-map-resolve@0.6.0: See GitHub - lydell/source-map-resolve: [DEPRECATED] Resolve the source map and/or sources for a generated file.
npm WARN deprecated urix@0.1.0: Please see GitHub - lydell/urix: [DEPRECATED] Makes Windows-style paths more unix and URI friendly.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated source-map-resolve@0.5.3: See GitHub - lydell/source-map-resolve: [DEPRECATED] Resolve the source map and/or sources for a generated file.
npm WARN deprecated date-format@2.1.0: 2.x is no longer supported. Please upgrade to 4.x or higher.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated resolve-url@0.2.1: GitHub - lydell/resolve-url: [DEPRECATED] Like Node.js’ `path.resolve`/`url.resolve` for the browser.
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
npm WARN deprecated streamroller@1.0.6: 1.x is no longer supported. Please upgrade to 3.x or higher.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated uuid@2.0.3: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See There’s Math.random(), and then there’s Math.random() · V8 for details.
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 There’s Math.random(), and then there’s Math.random() · V8 for details.
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 There’s Math.random(), and then there’s Math.random() · V8 for details.
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 There’s Math.random(), and then there’s Math.random() · V8 for details.
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 There’s Math.random(), and then there’s Math.random() · V8 for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see Request’s Past, Present and Future · Issue #3142 · request/request · GitHub
npm WARN deprecated @schematics/update@0.1102.11: This was an internal-only Angular package up through Angular v11 which is no longer used or maintained. Upgrade Angular to v12+ to remove this dependency.
npm WARN deprecated log4js@4.5.1: 4.x is no longer supported. Please upgrade to 6.x or higher.
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated @angular/http@7.0.0: Package no longer supported. Use @angular/common instead, see Angular
npm WARN deprecated protractor@5.4.4: We have news to share - Protractor is deprecated and will reach end-of-life by Summer 2023. To learn more and find out about other options please refer to this post on the Angular blog. Thank you for using and contributing to Protractor. https://goo.gle/state-of-e2e-in-angular
npm WARN deprecated core-js@2.6.12: core-js@<3.23.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. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@3.8.3: core-js@<3.23.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. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js-pure@3.11.1: core-js-pure@<3.23.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. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js-pure.
npm WARN deprecated core-js@3.11.1: core-js@<3.23.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. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli ‘C:\Program Files\nodejs\node.exe’,
npm ERR! gyp verb cli ‘C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\node-gyp\bin\node-gyp.js’,
npm ERR! gyp verb cli ‘rebuild’,
npm ERR! gyp verb cli ‘–verbose’,
npm ERR! gyp verb cli ‘–libsass_ext=’,
npm ERR! gyp verb cli ‘–libsass_cflags=’,
npm ERR! gyp verb cli ‘–libsass_ldflags=’,
npm ERR! gyp verb cli ‘–libsass_library=’
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@18.0.0 | win32 | x64
npm ERR! gyp verb command rebuild
npm ERR! gyp verb command clean
npm ERR! gyp verb clean removing “build” directory
npm ERR! gyp verb command configure
npm ERR! gyp verb check python checking for Python executable “python2” in the PATH
npm ERR! gyp verb which failed Error: not found: python2
npm ERR! gyp verb which failed at getNotFoundError (C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\which\which.js:13:12)
npm ERR! gyp verb which failed at F (C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\which\which.js:68:19)
npm ERR! gyp verb which failed at E (C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\which\which.js:80:29)
npm ERR! gyp verb which failed at C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\which\which.js:89:16
npm ERR! gyp verb which failed at C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\isexe\index.js:42:5
npm ERR! gyp verb which failed at C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb which failed at FSReqCallback.oncomplete (node:fs:203:21)
npm ERR! gyp verb which failed python2 Error: not found: python2
npm ERR! gyp verb which failed at getNotFoundError (C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\which\which.js:13:12)
npm ERR! gyp verb which failed at F (C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\which\which.js:68:19)
npm ERR! gyp verb which failed at E (C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\which\which.js:80:29)
npm ERR! gyp verb which failed at C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\which\which.js:89:16
npm ERR! gyp verb which failed at C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\isexe\index.js:42:5
npm ERR! gyp verb which failed at C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb which failed at FSReqCallback.oncomplete (node:fs:203:21) {
npm ERR! gyp verb which failed code: ‘ENOENT’
npm ERR! gyp verb which failed }
npm ERR! gyp verb check python checking for Python executable “python” in the PATH
npm ERR! gyp verb which failed Error: not found: python
npm ERR! gyp verb which failed at getNotFoundError (C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\which\which.js:13:12)
npm ERR! gyp verb which failed at F (C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\which\which.js:68:19)
npm ERR! gyp verb which failed at E (C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\which\which.js:80:29)
npm ERR! gyp verb which failed at C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\which\which.js:89:16
npm ERR! gyp verb which failed at C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\isexe\index.js:42:5
npm ERR! gyp verb which failed at C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb which failed at FSReqCallback.oncomplete (node:fs:203:21)
npm ERR! gyp verb which failed python Error: not found: python
npm ERR! gyp verb which failed at getNotFoundError (C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\which\which.js:13:12)
npm ERR! gyp verb which failed at F (C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\which\which.js:68:19)
npm ERR! gyp verb which failed at E (C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\which\which.js:80:29)
npm ERR! gyp verb which failed at C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\which\which.js:89:16
npm ERR! gyp verb which failed at C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\isexe\index.js:42:5
npm ERR! gyp verb which failed at C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb which failed at FSReqCallback.oncomplete (node:fs:203:21) {
npm ERR! gyp verb which failed code: ‘ENOENT’
npm ERR! gyp verb which failed }
npm ERR! gyp verb could not find “python”. checking python launcher
npm ERR! gyp verb could not find “python”. guessing location
npm ERR! gyp verb ensuring that file exists: C:\Python27\python.exe
npm ERR! gyp verb check python version C:\Python27\python.exe -c "import sys; print "2.7.0 npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];" returned: %j
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 18.0.0
npm ERR! gyp verb command install [ ‘18.0.0’ ]
npm ERR! gyp verb install input version string “18.0.0”
npm ERR! gyp verb install installing version: 18.0.0
npm ERR! gyp verb install --ensure was passed, so won’t reinstall if already installed
npm ERR! gyp verb install version not already installed, continuing with install 18.0.0
npm ERR! gyp verb ensuring nodedir is created C:\Users\EBLServiceRequest.EWMWEALTH.node-gyp\18.0.0
npm ERR! gyp verb created nodedir C:\Users\EBLServiceRequest.EWMWEALTH.node-gyp\18.0.0
npm ERR! gyp http GET https://nodejs.org/download/release/v18.0.0/node-v18.0.0-headers.tar.gz
npm ERR! gyp WARN install got an error, rolling back install
npm ERR! gyp verb command remove [ ‘18.0.0’ ]
npm ERR! gyp verb remove using node-gyp dir: C:\Users\EBLServiceRequest.EWMWEALTH.node-gyp
npm ERR! gyp verb remove removing target version: 18.0.0
npm ERR! gyp verb remove removing development files for version: 18.0.0
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: read ECONNRESET
npm ERR! gyp ERR! stack at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20)
npm ERR! gyp ERR! System Windows_NT 10.0.14393
npm ERR! gyp ERR! command “C:\Program Files\nodejs\node.exe” “C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\node-gyp\bin\node-gyp.js” “rebuild” “–verbose” “–libsass_ext=” “–libsass_cflags=” “–libsass_ldflags=” “–libsass_library=”
npm ERR! gyp ERR! cwd C:\Jenkins\workspace\Swift_IM_UI_UAT\node_modules\node-sass
npm ERR! gyp ERR! node -v v18.0.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\EBLServiceRequest.EWMWEALTH\AppData\Local\npm-cache_logs\2023-08-31T11_58_50_233Z-debug-0.log
[Pipeline] }
[Pipeline] // ws
[Pipeline] httpRequest
HttpMethod: POST
URL: https://prod2-29.centralindia.logic.azure.com/workflows/9c9e801553cc4884840af45cb943cd18/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=v1H0Q0_i5mFa4MvI6GAbos2dmNcB3Al72yLfdKDaQsU
Content-Type: application/json
Sending request to url: https://prod2-29.centralindia.logic.azure.com/workflows/9c9e801553cc4884840af45cb943cd18/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=v1H0Q0_i5mFa4MvI6GAbos2dmNcB3Al72yLfdKDaQsU
Response Code: HTTP/1.1 202 Accepted
Response:

Success code from [100‥399]
[Pipeline] notifyBitbucket
Notifying Bitbucket at “https://bitbucket.org
Failed to notify Bitbucket for commit bd4358e9fef979546b25db5ca0965f726c93c85d ()
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE

The error is not related to Jenkins itself, but rather the environment the agent runs in:

If you take a look at the warning, you can see what’s used and what the project expects to have.

That version doesn’t exist btw :eyes: