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

[Help](/c/help/9)

# TypeError: n?.on is not a function

106 views · 0 likes · 4 posts


Gaisdav (@gaisdav) · 2024-08-04

Hi :wave:
I have an 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: 56049aee0920]
Node.js process exited with exit status: 128. The logs above can help with debugging the issue.
INIT_REPORT Init Duration: 1104.43 ms	Phase: init	Status: error	Error Type: Runtime.ExitError
```

This is hyper-express typescript project for server.
Unfortunately I have no idea what is the problem.
 
You can find the source code here: https://github.com/gaisdav/wishlist-server

Thank you!


Pauline P. Narvas (@pawlean) · 2024-08-05

Hi, @gaisdav!

Some logs would help us a lot here. :smile: 

Could you try logging the value of `n` to see it's what is expected in your project?

```
console.log('n:', n);
n?.on('event', () => {
  console.log('Event triggered');
});

```


Gaisdav (@gaisdav) · 2024-08-05

Hi @ [pawlean](https://community.vercel.com/u/pawlean)
I added and now I see an another error:

```
(node:9) ExperimentalWarning: vm.USE_MAIN_CONTEXT_DEFAULT_LOADER is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
ReferenceError: n is not defined
    at file:///var/task/dist/index.js:1:15143
    at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
    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: 1232.32 ms	Phase: init	Status: error	Error Type: Runtime.ExitError
```


Gaisdav (@gaisdav) · 2024-08-13

Hello! any thoughts? :raised_hands: