Uncaught Exception {“”errorType””:””Runtime.ImportModuleError””,””errorMessage””:””Error: Cannot find module ‘serverless’

i setup the nest js application using serverless and when im using sls offline it works fine but when i deployed it gives errors:

error logs:-
1712045182841,”2024-04-02T08:06:22.841Z undefined ERROR Uncaught Exception {“”errorType””:””Runtime.ImportModuleError””,””errorMessage””:””Error: Cannot find module ‘serverless’
Require stack:

  • /var/runtime/index.mjs””,””stack””:[“”Runtime.ImportModuleError: Error: Cannot find module ‘serverless'””,””Require stack:””,””- /var/runtime/index.mjs””,”” at _loadUserApp (file:///var/runtime/index.mjs:1087:17)””,”” at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)””,”” at async start (file:///var/runtime/index.mjs:1282:23)””,”” at async file:///var/runtime/index.mjs:1288:1″”]}

    1712045182896,”INIT_REPORT Init Duration: 163.55 ms Phase: invoke Status: error Error Type: Runtime.ExitError

sls offline works fine](https://i.stack.imgur.com/jkvtH.png)

but deployed code to aws lamda its not working..