Error cannot find module after deploying Cron app

After I deploy, I get the message “Error: Cannot find module ‘axios’” . This will run locally, and I have run npm install in the root directory. I’m not sure why it’s not coming over to AWS even though it’s in the package.json file. Below is a screenshot of the code and the file structure. Below that is the package.json file that I’m deploying with.


Packages are included because they are found in import statements. Are you using older require() or es6 style imports (es6 works better).

Also you’re showing typescript in dev dependencies but all your files are .js. Are you using typescript?

I was going to phase in typescript, but I don’t have it in right now. I tried it without the typescript requirement with the same result. That being said, I am using older require statements. I’ll go ahead and use imports instead to see if that helps.

The problem I’m having with this approach is the fact that the built-in function deployed with serverless uses a require statement.

I cannot use this when I add
“type”: “module”
To the package.json file to support import statements. Also, I’ve tried changing this to an import statement, and I get the error:
The requested module ‘./serverless_sdk/index.js’ does not provide an export named ‘serverlessSDK’"

I found the root cause of this. I’ve been using serverless-plugin-include-dependencies to deploy my functions as the npm libraries with the solution has grown to a point that it won’t deploy without it. In certain environments, the latest version (version 5 at the time of this) doesn’t deploy any dependencies. I rolled back the version to 4.1 and it seemed to work.
Also note, that it took about 8 or 9 minutes to deploy and it looked like it froze, but did eventually work, so if anyone else is reading this and runs into this, I hope I’ve just saved you hours worth of time.