# Error: Cannot find module '@temporalio/workflow' at webpackEmptyContext

**URL:** <https://community.temporal.io/t/error-cannot-find-module-temporalio-workflow-at-webpackemptycontext/17944>\
**Category:** Community Support\
**Tags:** typescript-sdk\
**Created:** [July 17, 2025, 11:08am UTC](https://community.temporal.io/t/error-cannot-find-module-temporalio-workflow-at-webpackemptycontext/17944 "2025-07-17T11:08:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sandeep\_Mishra](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/sandeep_mishra/32/7490_2.png) [@Sandeep\_Mishra](https://community.temporal.io/u/Sandeep_Mishra)\
**Post date:** [July 17, 2025, 11:08am UTC](https://community.temporal.io/t/error-cannot-find-module-temporalio-workflow-at-webpackemptycontext/17944/1 "2025-07-17T11:08:23Z")

</div>

I’m working with a TypeScript monorepo. When running the Temporal worker locally, everything works as expected — the worker starts up correctly and is able to process workflows without any issues.

However, when running the worker from the build (production) environment, the worker starts fine, but as soon as a workflow is triggered, I encounter the following error:

[ERROR] Failed to process Workflow Activation {  
sdkComponent: ‘worker’,  
taskQueue: ‘appointment-confirmation-task-queue’,  
runId: ‘0198170c-c5ae-7e09-865e-6876655fc581’,  
error: /Users/sandeep-ah/Desktop/projects1/asha/api/build/workflow-bundle-b304755c459f4d72a5dc.js:8957  
throw e;  
^

Error: Cannot find module ‘@temporalio/workflow’  
at webpackEmptyContext (/Users/sandeep-ah/Desktop/projects1/asha/api/build/temporalWorkerWorkflows|sync:2:0)  
at /Users/sandeep-ah/Desktop/projects1/asha/api/build/temporalWorkerWorkflows/index.js:22:0  
at /Users/sandeep-ah/Desktop/projects1/asha/api/build/temporalWorkerWorkflows/index.js:12:0  
at ./temporalWorkerWorkflows/index.js (/Users/sandeep-ah/Desktop/projects1/asha/api/build/temporalWorkerWorkflows/index.js:18:1)  
at **webpack\_require** (webpack/bootstrap:19:0)  
at importWorkflows (/Users/sandeep-ah/Desktop/projects1/asha/api/build/temporalWorkerWorkflows/index-autogenerated-entrypoint.cjs:9:9)  
at Object.initRuntime (/Users/sandeep-ah/Desktop/projects1/asha/node\_modules/@temporalio/workflow/src/worker-interface.ts:78:16)  
at \_\_TEMPORAL\_CALL\_INTO\_SCOPE (evalmachine.:30:40)  
at evalmachine.:1:1  
at Script.runInContext (node:vm:149:12),  
workflowExists: false  
}  
2025-07-17T06:22:49.948496Z WARN temporal\_sdk\_core::worker::workflow: Failing workflow task run\_id=0198170c-c5ae-7e09-865e-6876655fc581 failure=Failure { failure: Some(Failure { message: “Cannot find module ‘@temporalio/workflow’”, source: “TypeScriptSDK”, stack\_trace: “/Users/sandeep-ah/Desktop/projects1/asha/api/build/workflow-bundle-b304755c459f4d72a5dc.js:8957\n\tthrow e;\n\t^\n\nError: Cannot find module ‘@temporalio/workflow’\n at webpackEmptyContext (/Users/sandeep-ah/Desktop/projects1/asha/api/build/temporalWorkerWorkflows|sync:2:0)\n at /Users/sandeep-ah/Desktop/projects1/asha/api/build/temporalWorkerWorkflows/index.js:22:0\n at /Users/sandeep-ah/Desktop/projects1/asha/api/build/temporalWorkerWorkflows/index.js:12:0\n at ./temporalWorkerWorkflows/index.js (/Users/sandeep-ah/Desktop/projects1/asha/api/build/temporalWorkerWorkflows/index.js:18:1)\n at **webpack\_require** (webpack/bootstrap:19:0)\n at importWorkflows (/Users/sandeep-ah/Desktop/projects1/asha/api/build/temporalWorkerWorkflows/index-autogenerated-entrypoint.cjs:9:9)\n at Object.initRuntime (/Users/sandeep-ah/Desktop/projects1/asha/node\_modules/@temporalio/workflow/src/worker-interface.ts:78:16)\n at \_\_TEMPORAL\_CALL\_INTO\_SCOPE (evalmachine.:30:40)\n at evalmachine.:1:1”, encoded\_attributes: None, cause: None, failure\_info: None }), force\_cause: Unspecified }

worker initialization code:

import { NativeConnection, Worker } from ‘@temporalio/worker’;  
import \* as activities from ‘./temporal/activities’;  
import { config, constants } from ‘./temporal/config’;

async function run() {  
try {  
const connection = await NativeConnection.connect({  
address: config.address,  
apiKey: config.apiKey,  
tls: {},  
});

```
const worker = await Worker.create({
  connection,
  namespace: config.namespace,
  workflowsPath: require.resolve('./temporalWorkerWorkflows'),
  activities,
  taskQueue: constants.APPOINTMENT_CONFIRMATION_TASK_QUEUE,
});

await worker.run();

```

} catch (error) {  
console.error(‘[TEMPORAL\_WORKER] Error:’, error);  
process.exit(1);  
}  
}

run().catch((err) =\> {  
console.error(‘[TEMPORAL\_WORKER] Unhandled error:’, err);  
process.exit(1);  
});
