bytenode: SyntaxError: Invalid or unexpected token
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.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 38
Using
--no-flush-bytecodeon 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 goodHi, I guess you get this problem due to bytecode flushing, just try this solution:
Fine. I will wait until WilianZilv and IBMRob responde, then I will publish a new version that sets this flag in bytenode itself. I will update README.md too to reflect this issue.
I was having the same issues described in this thread too. Setting
--no-flush-bytecodeas suggested by @a-parser seems to have fixed it for me.We think this might be a problem with express where it doesn’t allow minification of comments i.e. it has:
at the top of all its
.jsfiles. If you replace the/*!with/**we no longer see the problem.@OsamaAbbas I cannot reproduce it with minimal code not sure what was the problem. but I can confirm that this problem is only occurred when use node v12