Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Cannot find modules" when compiling a TypeScript project #30

Open
mushketyk opened this issue May 7, 2019 · 9 comments
Open

"Cannot find modules" when compiling a TypeScript project #30

mushketyk opened this issue May 7, 2019 · 9 comments

Comments

@mushketyk
Copy link

When I try to deploy a serverless project with the serverless-plugin-include-dependencies plugin I get the following error:

Cannot find module '.../src/function'

With the following stacktrace:

Error: Cannot find module '.../src/function'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:587:15)
    at Function.resolve (internal/modules/cjs/helpers.js:32:19)
    at IncludeDependencies.getHandlerFilename (.../node_modules/serverless-plugin-include-dependencies/include-dependencies.js:134:20)

I think the bug is that it is looking for a file src/function (that does not exist), while the file it should be looking for is src/function.ts that exists.

Here is my configuration:

plugins:
  - serverless-webpack
  - serverless-reqvalidator-plugin
  - serverless-aws-documentation
  - serverless-plugin-canary-deployments
  - serverless-dynamodb-local
  - serverless-offline
  - serverless-plugin-include-dependencies

package:
  individually: true

Here is the version of the plugin that I use:

"serverless-plugin-include-dependencies": "^3.2.1",
@dsmileym4
Copy link

We are experiencing this same issue.

@dougmoscrop
Copy link
Owner

I don't use TypeScript unfortunately! I'm open to PRs of course.

Don't you have to compile your .ts files in to .js files? Are those not referenced by serverless.yml or does it support TS directly?

@yzpaul
Copy link

yzpaul commented May 20, 2020

I don't use TypeScript unfortunately! I'm open to PRs of course.

Don't you have to compile your .ts files in to .js files? Are those not referenced by serverless.yml or does it support TS directly?

Serverless compiles TS into JS in <PROJ_ROOT>/.build

@HarshUpparwal
Copy link

any workaround this plugin?

Inspite of having file at said path, error msg pops up saying Cannot find module

@env-poehler
Copy link

env-poehler commented Jun 27, 2022

I was also having this issue. However, I managed to get it working by installing the npm package 'serverless-plugin-typescript'

@denis-ryzhkov
Copy link

@env-poehler, do you have both serverless-plugin-include-dependencies and serverless-plugin-typescript in serverless.yml and both are working? I had to delete serverless-plugin-include-dependencies to make it work.

@nick-verida
Copy link

I can confirm removing serverless-plugin-include-dependencies helped with this.

@jeison-od
Copy link

@denis-ryzhkov I can confirm it too!

@brayoh
Copy link

brayoh commented Sep 23, 2024

Experiencing a similar issue, any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants