Issue
I am trying to use frontend-maven-plugin to build springboot + react project,I am successfully able to run the build in local machine but when the build runs in a teamcity agent it fails. I have to bypass corporate proxy so that npm install works as it was failing with other issue earlier
pom.xml
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.6</version>
<configuration>
<workingDirectory>ireporter</workingDirectory>
<installDirectory>target</installDirectory>
<npmInheritsProxyConfigFromMaven>false</npmInheritsProxyConfigFromMaven>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v10.15.2</nodeVersion>
</configuration>
</execution>
<execution>
<id>npm set strict-ssl false</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>set strict-ssl false</arguments>
</configuration>
</execution>
<execution>
<id>npm config ls -l </id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>config ls -l</arguments>
</configuration>
</execution>
<execution>
<id>npm install </id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install --userconfig ${project.basedir}/ireporter/.npmrc --loglevel verbose</arguments>
</configuration>
</execution>
<execution>
<id>npm run build</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run build </arguments>
<npmInheritsProxyConfigFromMaven>false</npmInheritsProxyConfigFromMaven>
</configuration>
</execution>
</executions>
</plugin>
We have organisational repository setup for npm in JFrog
Below is the error , I am facing
Tc logs
09:07:00][Step 1/6] [DEBUG] (f) workingDirectory = /opt/build1/project/apps/tc-agent/work/f851513f359b3dee/dashboard-service/ireporter
[09:07:00][Step 1/6] [DEBUG] (f) execution = com.github.eirslett:frontend-maven-plugin:1.6:npm {execution: npm install}
[09:07:00][Step 1/6] [DEBUG] -- end configuration --
[09:07:00][Step 1/6] [INFO] npm not inheriting proxy config from Maven
[09:07:00][Step 1/6] [INFO] Running 'npm install --userconfig /opt/build1/project/apps/tc-agent/work/f851513f359b3dee/dashboard-service/ireporter/.npmrc --loglevel verbose' in /opt/build1/project/apps/tc-agent/work/f851513f359b3dee/dashboard-service/ireporter
[09:07:00][Step 1/6] [DEBUG] Executing command line [/opt/build1/project/apps/tc-agent/work/f851513f359b3dee/dashboard-service/target/node/node, /opt/build1/project/apps/tc-agent/work/f851513f359b3dee/dashboard-service/target/node/node_modules/npm/bin/npm-cli.js, install, --userconfig, /opt/build1/project/apps/tc-agent/work/f851513f359b3dee/dashboard-service/ireporter/.npmrc, --loglevel, verbose]
[09:07:00][Step 1/6] [ERROR] npm info it worked if it ends with ok
[09:07:00][Step 1/6] [ERROR] npm verb cli [ '/opt/build1/project/apps/tc-agent/work/f851513f359b3dee/dashboard-service/target/node/node',
[09:07:00][Step 1/6] [ERROR] npm verb cli '/opt/build1/project/apps/tc-agent/work/f851513f359b3dee/dashboard-service/target/node/node_modules/npm/bin/npm-cli.js',
[09:07:00][Step 1/6] [ERROR] npm verb cli 'install',
[09:07:00][Step 1/6] [ERROR] npm verb cli '--userconfig',
[09:07:00][Step 1/6] [ERROR] npm verb cli '/opt/build1/project/apps/tc-agent/work/f851513f359b3dee/dashboard-service/ireporter/.npmrc',
[09:07:00][Step 1/6] [ERROR] npm verb cli '--loglevel',
[09:07:00][Step 1/6] [ERROR] npm verb cli 'verbose' ]
[09:07:00][Step 1/6] [ERROR] npm info using [email protected]
[09:07:00][Step 1/6] [ERROR] npm info using [email protected]
[09:07:00][Step 1/6] [ERROR] npm verb config Skipping project config: /opt/build1/project/apps/tc-agent/work/f851513f359b3dee/dashboard-service/ireporter/.npmrc. (matches userconfig)
[09:07:00][Step 1/6] [ERROR] npm verb npm-session a11a05de741de457
[09:07:00][Step 1/6] [ERROR] npm info lifecycle [email protected]~preinstall: [email protected]
[09:07:00][Step 1/6] [ERROR] npm timing stage:loadCurrentTree Completed in 16ms
[09:07:00][Step 1/6] [ERROR] npm timing stage:loadIdealTree:cloneCurrentTree Completed in 1ms
[09:07:00][Step 1/6] [WARNING] npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
[09:07:02][Step 1/6] [ERROR] npm timing stage:loadIdealTree:loadShrinkwrap Completed in 1801ms
[09:07:04][Step 1/6] [ERROR] npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 2340ms
[09:07:05][Step 1/6] [ERROR] npm timing stage:loadIdealTree Completed in 5236ms
[09:07:07][Step 1/6] [ERROR] npm timing stage:generateActionsToTake Completed in 1188ms
[09:07:08][Step 1/6] [ERROR] npm verb correctMkdir /home/phxadm/.npm/_locks correctMkdir not in flight; initializing
[09:07:08][Step 1/6] [ERROR] npm timing audit compress Completed in 22ms
[09:07:08][Step 1/6] [ERROR] npm info audit Submitting payload of 147752bytes
[09:07:08][Step 1/6] [ERROR] npm verb lock using /home/phxadm/.npm/_locks/staging-1e9fbe1e42e7288a.lock for /opt/build1/project/apps/tc-agent/work/f851513f359b3dee/dashboard-service/ireporter/node_modules/.staging
[09:07:11][Step 1/6] [ERROR] npm http fetch POST 400 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/-/npm/v1/security/audits/quick 3091ms
[09:07:12][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/workbox-range-requests 1752ms
[09:07:13][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/webpack-manifest-plugin 1752ms
[09:07:13][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/yallist 1398ms
[09:07:13][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/whatwg-url 1627ms
[09:07:13][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/workbox-range-requests/-/workbox-range-requests-5.1.4.tgz 630ms
[09:07:13][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@babel%2fplugin-proposal-nullish-coalescing-operator 4727ms
[09:07:13][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/import-local 1428ms
[09:07:13][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/webpack-manifest-plugin/-/webpack-manifest-plugin-2.2.0.tgz 571ms
[09:07:13][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/yallist/-/yallist-3.1.1.tgz 602ms
[09:07:14][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/whatwg-url/-/whatwg-url-8.5.0.tgz 619ms
[09:07:14][Step 1/6] [ERROR] npm http fetch GET 304 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/yallist 3907ms
[09:07:14][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/fs-extra 1997ms
[09:07:14][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.14.2.tgz 640ms
[09:07:14][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/ws 2217ms
[09:07:14][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/fsevents 1826ms
[09:07:14][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/vendors 1404ms
[09:07:14][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/import-local/-/import-local-2.0.0.tgz 653ms
[09:07:14][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/fsevents 1642ms
[09:07:14][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/yallist/-/yallist-4.0.0.tgz 564ms
[09:07:14][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/fs-extra/-/fs-extra-7.0.1.tgz 578ms
[09:07:14][Step 1/6] [ERROR] npm http fetch GET 304 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/ws 4448ms
[09:07:15][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/ws/-/ws-6.2.1.tgz 662ms
[09:07:15][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/fsevents/-/fsevents-1.2.13.tgz 680ms
[09:07:15][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/yaml 5120ms
[09:07:15][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/vendors/-/vendors-1.0.4.tgz 664ms
[09:07:15][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/fsevents/-/fsevents-1.2.13.tgz 609ms
[09:07:15][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/xml-name-validator 4978ms
[09:07:15][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/y18n 5149ms
[09:07:15][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/ws/-/ws-7.4.5.tgz 628ms
[09:07:15][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/xmlchars 5213ms
[09:07:15][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/yaml/-/yaml-1.10.2.tgz 750ms
[09:07:16][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/xml-name-validator/-/xml-name-validator-3.0.0.tgz 821ms
[09:07:16][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/y18n/-/y18n-4.0.3.tgz 802ms
[09:07:16][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/workbox-sw 5271ms
[09:07:16][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/yargs 6478ms
[09:07:16][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/xmlchars/-/xmlchars-2.2.0.tgz 770ms
[09:07:16][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/workbox-sw/-/workbox-sw-5.1.4.tgz 539ms
[09:07:16][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/yargs/-/yargs-15.4.1.tgz 530ms
[09:07:17][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@babel%2fplugin-proposal-unicode-property-regex 1598ms
[09:07:18][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@sinonjs%2fcommons 1530ms
[09:07:18][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.12.13.tgz 434ms
[09:07:18][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@sinonjs/commons/-/commons-1.8.3.tgz 477ms
[09:07:18][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@babel%2fplugin-transform-modules-amd 1443ms
[09:07:19][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@babel%2fhelper-hoist-variables 1481ms
[09:07:19][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@babel%2fplugin-transform-exponentiation-operator 1653ms
[09:07:19][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.14.2.tgz 599ms
[09:07:19][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@babel%2ftraverse 1877ms
[09:07:19][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@babel%2fhelper-explode-assignable-expression 1775ms
[09:07:19][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@babel/helper-hoist-variables/-/helper-hoist-variables-7.13.16.tgz 574ms
[09:07:19][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.12.13.tgz 507ms
[09:07:19][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@babel/traverse/-/traverse-7.14.2.tgz 509ms
[09:07:20][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.13.0.tgz 470ms
[09:07:30][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/webpack 20655ms
[09:07:31][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@typescript-eslint%2fparser 14295ms
[09:07:31][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@babel%2fplugin-transform-reserved-words 3470ms
[09:07:31][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@typescript-eslint/parser/-/parser-4.23.0.tgz 351ms
[09:07:31][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.12.13.tgz 397ms
[09:07:31][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/webpack/-/webpack-4.44.2.tgz 661ms
[09:07:35][Step 1/6] [ERROR] npm http fetch GET 200 https://artifactory.server.irgrp.net/artifactory/api/npm/npm-central/fsevents/-/fsevents-2.3.2.tgz 10334ms attempt #2
[09:07:35][Step 1/6] [ERROR] npm timing action:extract Completed in 26723ms
[09:07:36][Step 1/6] [ERROR] npm timing action:finalize Completed in 1284ms
[09:07:38][Step 1/6] [ERROR] npm timing npm Completed in 38312ms
[09:07:38][Step 1/6] [ERROR] npm ERR! cb() never called!
[09:07:38][Step 1/6] [ERROR]
[09:07:38][Step 1/6] [ERROR] npm ERR! This is an error with npm itself. Please report this error at:
[09:07:38][Step 1/6] [ERROR] npm ERR! <https://npm.community>
[09:07:38][Step 1/6] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.6:npm (npm install) on project smat-service: Failed to run task
[09:07:38][Step 1/6] [INFO] ------------------------------------------------------------------------
[09:07:38][Step 1/6] [INFO] BUILD FAILURE
[09:07:38][Step 1/6] [INFO] ------------------------------------------------------------------------
Solution
It was an proxy issue at the teamcity agent ,there was 2 ways to solve this
To ssh handshake between teamcity agent and jfrog npm artifactory being used in our organisation
To put authentication key and url in .npmrc file you can refer https://www.jfrog.com/confluence/display/JFROG/npm+Registry
I did it with point 2 as it is difficult to take approvals to do handshake between 2 servers in my organisation.
Answered By - abs
Answer Checked By - Pedro (JavaFixing Volunteer)