[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live)

[Help](/c/help/9)

# "SyntaxError: Named export not found" in compiled ts project

375 views · 1 like · 5 posts


Gaisdav (@gaisdav) · 2024-08-01

```
file:///var/task/dist/index.js:4
import { bootstrap } from './bootstrap';
         ^^^^^^^^^
SyntaxError: Named export 'bootstrap' not found. The requested module './bootstrap' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from './bootstrap';
const { bootstrap } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async c (/opt/rust/nodejs.js:8:14633)
Node.js process exited with exit status: 1. The logs above can help with debugging the issue.
INIT_REPORT Init Duration: 224.63 ms	Phase: invoke	Status: error	Error Type: Runtime.ExitError
```


you can see my source code in project.

here is my tsconfig.json: 

```
{
  "compilerOptions": {
    "target": "ES2022",
    "lib": ["ES2022"],
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "module": "ES2022",
    "rootDir": "src",
    "moduleResolution": "Node",
    "baseUrl": "./",
    "types": ["node"],
    "resolveJsonModule": true,
    "allowJs": true,
    "declaration": false,
    "outDir": "dist",
    "removeComments": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "noImplicitAny": true,
    "strictPropertyInitialization": false,
    "skipLibCheck": true
  },
  "exclude": ["node_modules", "eslint.config.mjs", "dist"]
}
```


Amy Egan (@amyegan) · 2024-08-01

Hey @gaisdav. Can you share more about your project to help us debug this issue with you? 

The easiest way for us to see what you see is if you share a [minimal reproducible example](https://vercel.com/guides/creating-a-minimal-reproducible-example). Short of that, it would be helpful to know the framework, file structure, build settings, and any other info you can share about the project setup.


Gaisdav (@gaisdav) · 2024-08-01

Sure. You can see my project here: [https://github.com/gaisdav/wishlist-server](https://github.com/gaisdav/wishlist-server)
it is the public repository. You can just clone it. 

For deploy I just run the command "yarn run deploy" in my project.

Let me know if you need something else.


Gaisdav (@gaisdav) · 2024-08-03

Hi @amyegan :wave:

I added a rollup to compile the typescript and now I have another error. Should I start a new topic? Or I can just change tis topic title?

Error:

TypeError: n?.on is not a function
    at Bt (/opt/rust/nodejs.js:8:17410)
    at on (/opt/rust/nodejs.js:9:322)
Unhandled Rejection: [External: 560b088ce720]
Node.js process exited with exit status: 128. The logs above can help with debugging the issue.
INIT_REPORT Init Duration: 1975.90 ms	Phase: invoke	Status: error	Error Type: Runtime.ExitError


Gaisdav (@gaisdav) · 2024-08-04 · ♥ 1

I am closing this topic, because I have another error. 

the next topic is here https://community.vercel.com/t/typeerror-n-on-is-not-a-function/433

By the way, thank you for your response :raised_hands: