Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Cannot read property 'match' of undefined" during Npm install

Tags:

node.js

npm

I encountered error during building Jenkins

Jenkins Log

Task :api:processResources Task :api:classes Task :web:nodeSetup Task :web:npmSetup /var/lib/jenkins/workspace/hds_v2_docker/web/.gradle/npm/npm-v6.11.2/bin/npm -> /var/lib/jenkins/workspace/hds_v2_docker/web/.gradle/npm/npm-v6.11.2/lib/node_modules/npm/bin/npm-cli.js /var/lib/jenkins/workspace/hds_v2_docker/web/.gradle/npm/npm-v6.11.2/bin/npx -> /var/lib/jenkins/workspace/hds_v2_docker/web/.gradle/npm/npm-v6.11.2/lib/node_modules/npm/bin/npx-cli.js

Task :web:npmInstall FAILED npm ERR! Cannot read property 'match' of undefined

npm ERR! A complete log of this run can be found in: npm ERR!
/var/lib/jenkins/.npm/_logs/2019-10-16T01_11_20_594Z-debug.log

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':web:npmInstall'.

Process 'command '/var/lib/jenkins/workspace/hds_v2_docker/web/.gradle/npm/npm-v6.11.2/bin/npm'' finished with non-zero exit value 1

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.0/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 33s

/var/lib/jenkins/.npm/_logs/2019-10-16T01_11_20_594Z-debug.log

17 silly saveTree   │ ├─┬ [email protected] 17 silly saveTree   │ │ └── [email protected] 17 silly saveTree   │ ├── [email protected] 17 silly saveTree   │ └── [email protected] 17 silly saveTree   └─┬ [email protected] 17 silly saveTree     ├── [email protected] 17 silly saveTree     ├── [email protected] 17 silly saveTree     └── [email protected] 18 verbose stack TypeError: Cannot read property 'match' of undefined 18 verbose stack     at tarballToVersion (/usr/local/lib/node_modules/npm/lib/install/inflate-shrinkwrap.js:87:20) 18 verbose stack     at inflatableChild (/usr/local/lib/node_modules/npm/lib/install/inflate-shrinkwrap.js:99:22) 18 verbose stack     at BB.each (/usr/local/lib/node_modules/npm/lib/install/inflate-shrinkwrap.js:55:12) 18 verbose stack     at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23) 18 verbose stack     at Object.gotValue (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/reduce.js:155:18) 18 verbose stack     at Object.gotAccum (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/reduce.js:144:25) 18 verbose stack     at Object.tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23) 18 verbose stack     at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31) 18 verbose stack     at Promise._settlePromise (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18) 18 verbose stack     at Promise._settlePromiseCtx (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:606:10) 18 verbose stack     at _drainQueueStep (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:142:12) 18 verbose stack     at _drainQueue (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:131:9) 18 verbose stack     at Async._drainQueues (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:147:5) 18 verbose stack     at Immediate.Async.drainQueues (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14) 18 verbose stack     at runCallback (timers.js:810:20) 18 verbose stack     at tryOnImmediate (timers.js:768:5) 19 verbose cwd /var/lib/jenkins/workspace/hds_v2_docker/web 20 verbose Linux 4.4.0-59-generic 21 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "install" 22 verbose node v8.16.0 23 verbose npm  v6.9.0 24 error Cannot read property 'match' of undefined 25 verbose exit [ 1, true ] 
like image 922
m2sj Avatar asked Oct 16 '19 01:10

m2sj


People also ask

What is Package-lock JSON?

package-lock. json is automatically generated for any operations where npm modifies either the node_modules tree, or package. json . It describes the exact tree that was generated, such that subsequent installs are able to generate identical trees, regardless of intermediate dependency updates.


1 Answers

Try removing your package-lock.json to see if that helps.

rm -rf package-lock.json  

Edit: If the issue still persists, delete node_modules as well.

rm -rf node_modules 
like image 111
Aditya Prakash Avatar answered Sep 19 '22 16:09

Aditya Prakash