question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error when run in node 12

See original GitHub issue
const Koa = require('koa');
const KoaRouter = require('koa-router');
const app = new Koa();
const router = new KoaRouter();

module.exports = class HttpServer {
  start() {
    router.get('/a', async ctx => {
      ctx.body = 'a';
    });

    router.get('/b', async ctx => {
      ctx.body = 'b';
    });

    router.get('/c', async ctx => {
      ctx.body = 'c';
    });

    router.get('/d', async ctx => {
      ctx.body = 'd';
    });

    app.use(router.routes()).use(router.allowedMethods());
    app.listen(3000);
  }
};

it raise libc++abi.dylib: terminating with uncaught exception of type std::out_of_range: vector when compile and run in node 12 with mac 10.14 (bytenode -c app.js && bytenode app.jsc) but it is ok when compile and run in node 10

change the code to

const Koa = require('koa');
const KoaRouter = require('koa-router');
const app = new Koa();
const router = new KoaRouter();

module.exports = class HttpServer {
  start() {
    router.get('/a', async ctx => {
      ctx.body = 'a';
    });

    router.get('/b', async ctx => {
      ctx.body = 'b';
    });

    router.get('/c', async ctx => {
      ctx.body = 'c';
    });

    // router.get('/d', async ctx => {
    //   ctx.body = 'd';
    // });

    app.use(router.routes()).use(router.allowedMethods());
    app.listen(3000);
  }
};

it is ok compile and run in node 12

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

2reactions
wanweidongcommented, May 15, 2019

Cool, it works now. thank you!

2reactions
OsamaAbbascommented, May 15, 2019

I guess I found it. V8 api was changed again. Compare this with this.

This indeed can be fixed in Bytenode.

Thank you for your report.

Read more comments on GitHub >

github_iconTop Results From Across the Web

15 Common Error Codes in Node.js and How to Fix Them
10. ENOENT ... This error is a straightforward one. It means "Error No Entity" and is raised when a specified path (file or...
Read more >
Errors | Node.js v19.3.0 Documentation
Node.js generates system errors when exceptions occur within its runtime environment. These usually occur when an application violates an operating system ...
Read more >
Error installing nodejs version 12 on alpine linux
In your case, nodejs 12.x package already exists so You should install nodejs if you want to install an older version instead of...
Read more >
ts-node - npm
This error is thrown by node when a module is require() d, but node believes it should execute as native ESM. This can...
Read more >
Syntax error not showing in stderr with `node --inspect-brk` in ...
HI, I'm trying a simple script with a syntax error in it but I'm not getting the error displayed when running with node...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found