Error in pipeline: Error: Cannot find module 'xmldom'
Asked by Harshvardhan Sharma:

Our pipeline is throwing error at a certain step. But running the same command in local works. Not sure what is happening. This was working last week but it is breaking today without any changes being pushed to the pipeline configurations or any kind of code to the repo. Any help is deeply appreciated.

**Command**: npm run generate:package (this commands runs an internal javascript file)

**Local output:**

npm run generate:package

\> sleep-country-occ@0.0.0 generate:package /Users/harsharma/Desktop/project  
\> node ./dev-scripts

2021-08-24T14:11:55.664Z info: Package updated successfully!!!

**Pipeline output:**  
+ npm run generate:package  
> generate:package /opt/atlassian/pipelines/agent/build  
> node ./dev-scripts  
internal/modules/cjs/loader.js:65$STAGE_TOSHIP_CONCURRENT_CONNECTIONS  
throw err;  
^  
Error: Cannot find module 'xmldom'  
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:649:$STAGE_TOSHIP_CONCURRENT_CONNECTIONS5)  
at Function.Module._load (internal/modules/cjs/loader.js:575:25)  
at Module.require (internal/modules/cjs/loader.js:705:$STAGE_TOSHIP_CONCURRENT_CONNECTIONS9)  
at require (internal/modules/cjs/helpers.js:$STAGE_TOSHIP_CONCURRENT_CONNECTIONS4:$STAGE_TOSHIP_CONCURRENT_CONNECTIONS6)  
at Object.<anonymous> (/opt/atlassian/pipelines/agent/build/libs/oms/index.js:4:2$UAT_PAYMENT_CONCURRENT_CONNECTIONS)  
at Module._compile (internal/modules/cjs/loader.js:799:$UAT_PAYMENT_CONCURRENT_CONNECTIONS0)  
at Object.Module._extensions..js (internal/modules/cjs/loader.js:8$STAGE_TOSHIP_CONCURRENT_CONNECTIONS0:$STAGE_TOSHIP_CONCURRENT_CONNECTIONS0)  
at Module.load (internal/modules/cjs/loader.js:666:$UAT_PAYMENT_CONCURRENT_CONNECTIONS2)  
at tryModuleLoad (internal/modules/cjs/loader.js:606:$STAGE_TOSHIP_CONCURRENT_CONNECTIONS2)  
at Function.Module._load (internal/modules/cjs/loader.js:598:$UAT_PAYMENT_CONCURRENT_CONNECTIONS)  
at Module.require (internal/modules/cjs/loader.js:705:$STAGE_TOSHIP_CONCURRENT_CONNECTIONS9)  
at require (internal/modules/cjs/helpers.js:$STAGE_TOSHIP_CONCURRENT_CONNECTIONS4:$STAGE_TOSHIP_CONCURRENT_CONNECTIONS6)  
at Object.<anonymous> (/opt/atlassian/pipelines/agent/build/api/controllers/OrderController.js:$STAGE_TOSHIP_CONCURRENT_CONNECTIONS2:$STAGE_TOSHIP_CONCURRENT_CONNECTIONS6)  
at Module._compile (internal/modules/cjs/loader.js:799:$UAT_PAYMENT_CONCURRENT_CONNECTIONS0)  
at Object.Module._extensions..js (internal/modules/cjs/loader.js:8$STAGE_TOSHIP_CONCURRENT_CONNECTIONS0:$STAGE_TOSHIP_CONCURRENT_CONNECTIONS0)  
at Module.load (internal/modules/cjs/loader.js:666:$UAT_PAYMENT_CONCURRENT_CONNECTIONS2)  
npm ERR! code ELIFECYCLE  
npm ERR! errno $STAGE_TOSHIP_CONCURRENT_CONNECTIONS  
npm ERR! sleep-country-occ@0.0.0 generate:package: `node ./dev-scripts`  
npm ERR! Exit status $STAGE_TOSHIP_CONCURRENT_CONNECTIONS  
npm ERR!  
npm ERR! Failed at the sleep-country-occ@0.0.0 generate:package script.  
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.  
npm ERR! A complete log of this run can be found in:  
npm ERR! /root/.npm/_logs/202$STAGE_TOSHIP_CONCURRENT_CONNECTIONS-08-24T$STAGE_TOSHIP_CONCURRENT_CONNECTIONS4_$STAGE_TOSHIP_CONCURRENT_CONNECTIONS$UAT_PAYMENT_CONCURRENT_CONNECTIONS_28_$STAGE_TOSHIP_CONCURRENT_CONNECTIONS58Z-debug.log


Answers:
author: Harshvardhan Sharma
body: Found the fix - it was missing dependencies.


Tags: bitbucket-pipelines

cloud