# Netlify-cli error "Cannot find module 'exports'"

**URL:** <https://answers.netlify.com/t/netlify-cli-error-cannot-find-module-exports/36556>\
**Category:** Support\
**Tags:** netlify-cli\
**Created:** [April 24, 2021, 8:27pm UTC](https://answers.netlify.com/t/netlify-cli-error-cannot-find-module-exports/36556 "2021-04-24T20:27:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaredh159](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/jaredh159/32/4839_2.png) [@jaredh159](https://answers.netlify.com/u/jaredh159)\
**Post date:** [April 24, 2021, 8:27pm UTC](https://answers.netlify.com/t/netlify-cli-error-cannot-find-module-exports/36556/1 "2021-04-24T20:27:11Z")

</div>

Problem with `netlify-cli`. I created a extremely simple [reproduction repository.](https://github.com/jaredh159/netlify-cli-bug-repro)

I’m using the new `@netlify/functions` first-class typescript support feature. _Love it (except for this problem), by the way, thanks!_

The problem is, I’m importing a dependency, the official AWS S3 client `@aws-sdk/client-s3`, and this is causing `netlify dev` to break. Here’s the relevant code from the repro:

```plaintext
import { Handler } from '@netlify/functions';
import { S3 } from '@aws-sdk/client-s3';

const handler: Handler = async (event) => {
  // Omitted: actually doing something with the S3 Client
  // vvvv--- but this line causes `netlify dev` to break
  const client = new S3({});

  return {
    statusCode: 200,
    body: `Hello world`,
  };
};

export { handler };

```

The error message reported by `netlify-cli` is “ **`Cannot find module 'exports'`** ” (full error message below).

NOTE: the function _builds just fine on netlify and works_, it’s just `netlify-cli` chokes on it.

If I comment out the usage of the `S3` imported function, the problem goes away (I presume because of esbuild tree-shaking or something).

I also made the recommended settings of `esModuleInterop` and `isolatedModules` in the `tsconfig.json` file.

Again, there’s a super simple reproduction here:

> **[GitHub - jaredh159/netlify-cli-bug-repro: Bug repro for issue with...](https://github.com/jaredh159/netlify-cli-bug-repro)**
>
> Bug repro for issue with netlify-cli, @see https://answers.netlify.com/t/netlify-cli-error-cannot-find-module-exports/36556 - GitHub - jaredh159/netlify-cli-bug-repro: Bug repro for issue with netl...

Just clone, npm install, and run `npm run dev` to see the issue. Thanks in advance for any help, and again, really love the first-class typescript support! 🙏

```plaintext
◈ Function builder zip-it-and-ship-it building functions from directory /netlify-cli-bug-repo/netlify/functions
◈ Function builder zip-it-and-ship-it finished building functions from directory /netlify-cli-bug-repo/netlify/functions
    Error: In file "/netlify-cli-bug-repo/.netlify/functions-serve/test/test.js"
    Cannot find module 'exports'
    Require stack:
    - /netlify-cli-bug-repo/node_modules/@netlify/zip-it-and-ship-it/src/node_dependencies/resolve.js
    - /netlify-cli-bug-repo/node_modules/@netlify/zip-it-and-ship-it/src/node_dependencies/index.js
    - /netlify-cli-bug-repo/node_modules/@netlify/zip-it-and-ship-it/src/main.js
    - /netlify-cli-bug-repo/node_modules/netlify/src/deploy/hash_fns.js
    - /netlify-cli-bug-repo/node_modules/netlify/src/deploy/index.js
    - /netlify-cli-bug-repo/node_modules/netlify/src/index.js
    - /netlify-cli-bug-repo/node_modules/@netlify/config/src/api/client.js
    - /netlify-cli-bug-repo/node_modules/@netlify/config/src/main.js
    - /netlify-cli-bug-repo/node_modules/netlify-cli/src/utils/command.js
    - /netlify-cli-bug-repo/node_modules/netlify-cli/src/commands/dev/index.js
    - /netlify-cli-bug-repo/node_modules/@oclif/config/lib/plugin.js
    - /netlify-cli-bug-repo/node_modules/@oclif/config/lib/config.js
    - /netlify-cli-bug-repo/node_modules/@oclif/config/lib/index.js
    - /netlify-cli-bug-repo/node_modules/@oclif/command/lib/command.js
    - /netlify-cli-bug-repo/node_modules/@oclif/command/lib/index.js
    - /netlify-cli-bug-repo/node_modules/netlify-cli/src/index.js
    - /netlify-cli-bug-repo/node_modules/netlify-cli/bin/run
    Code: MODULE_NOT_FOUND

```

---

<div class="post-metadata">

**Author:** ![jen](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/jen/32/6044_2.png) [@jen](https://answers.netlify.com/u/jen)\
**Post date:** [April 25, 2021, 12:05am UTC](https://answers.netlify.com/t/netlify-cli-error-cannot-find-module-exports/36556/2 "2021-04-25T00:05:26Z")

</div>

Hey @jaredh159,  
Would you mind filing this on the CLI repo? [Sign in to GitHub · GitHub](https://github.com/netlify/cli/issues/new/choose) It’ll get 👀 quicker that way. Also very glad to hear that you’re excited about the Typescript support, I’ll pass that along to the team!

---

<div class="post-metadata">

**Author:** ![jaredh159](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/jaredh159/32/4839_2.png) [@jaredh159](https://answers.netlify.com/u/jaredh159)\
**Post date:** [April 25, 2021, 1:02pm UTC](https://answers.netlify.com/t/netlify-cli-error-cannot-find-module-exports/36556/3 "2021-04-25T13:02:23Z")

</div>

sure, I was wondering when I opened this if that would be a better spot.

[Done.](https://github.com/netlify/cli/issues/2227)
