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.

SyntaxError: Invalid or unexpected token

See original GitHub issue

Sending messages to worker:

(node:30) UnhandledPromiseRejectionWarning: SyntaxError: Invalid or unexpected token
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

Express random error when i enter a route that doesn’t exists

SyntaxError: Invalid or unexpected token
    at Layer.handle [as handle_request] (/sistema/server/node_modules/express/lib/router/layer.js:95:5)
    at next (/sistema/server/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/sistema/server/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/sistema/server/node_modules/express/lib/router/layer.js:95:5)
    at /sistema/server/node_modules/express/lib/router/index.js:281:22
    at param (/sistema/server/node_modules/express/lib/router/index.js:354:14)
    at param (/sistema/server/node_modules/express/lib/router/index.js:365:14)
    at Function.process_params (/sistema/server/node_modules/express/lib/router/index.js:410:3)
    at next (/sistema/server/node_modules/express/lib/router/index.js:275:10)
    at SendStream.error (/sistema/server/node_modules/serve-static/index.js:121:7)
    at SendStream.emit (events.js:210:5)
    at SendStream.error (/sistema/server/node_modules/send/index.js:270:17)
    at SendStream.onStatError (/sistema/server/node_modules/send/index.js:421:12)
    at next (/sistema/server/node_modules/send/index.js:735:16)
    at onstat (/sistema/server/node_modules/send/index.js:724:14)
    at FSReqCallback.oncomplete (fs.js:158:21)

This is one of the many errors i get when i run my project compiled with bytenode. Any help? My project is stable with the source code. But i need to protect it.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:38

github_iconTop GitHub Comments

2reactions
IBMRobcommented, Jan 26, 2020

Using --no-flush-bytecode on the bytenode command line has also resolved this issue for us too. If there is a way to always do this so we don’t need to have custom command lines it would be good

2reactions
a-parsercommented, Jan 18, 2020

Hi, I guess you get this problem due to bytecode flushing, just try this solution:

const v8 = require('v8');
v8.setFlagsFromString('--no-flush-bytecode');
Read more comments on GitHub >

github_iconTop Results From Across the Web

SyntaxError: Unexpected token - JavaScript - MDN Web Docs
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >
Uncaught SyntaxError: Invalid or unexpected token
I am a beginner so I get stuck in syntax a lot. If it is that then please help me out. javascript ·...
Read more >
Have a JavaScript Unexpected Token Error? Check Your Syntax
The JavaScript's parser expects tokens and symbols in a particular order, with relevant values or variables in between. Often, an Unexpected ...
Read more >
JavaScript Error Handling: Unexpected Token - GeeksforGeeks
Not follow them throws an error.An unexpected token occurs if JavaScript code has a missing or extra character { like, ) + –...
Read more >
JavaScript SyntaxError: Invalid or unexpected token ... - IBM
The issue now is that the page is blank and we have a javascript error in the web console. Error: "SyntaxError: Invalid or...
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