4.1 Unexpected token function
See original GitHub issuebodyparser(4.1) in Koa(2.2.0)
just use like app.use(bodyParser());
error showed as below:
/some/path/node_modules/koa-bodyparser/index.js:69
return async function bodyParser(ctx, next) {
^^^^^^^^
SyntaxError: Unexpected token function
at Object.exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:513:28)
at Module._extensions..js (module.js:550:10)
at Object.require.extensions.(anonymous function) [as .js] (/Users/zhangyan/Documents/Zalaxy/node_modules/babel-register/lib/node.js:152:7)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/some/path/server/app.js:4:20)
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:8 (1 by maintainers)
Top 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 >SyntaxError: Unexpected token function - Async Await Nodejs
You'll need to transpile your code (e.g. using Babel) to a version of JS that Node understands if you are using an older...
Read more >Unexpected token - Routing - Ghost Forum
I want to make autodeploy themes from github. I did it sort of like everything according to the instructions: Deploy Ghost Theme
Read more >T189451 Jenkins fails to merge a patch with "Unexpected ...
Jenkins fails to merge a patch with "Unexpected token function". Closed, ResolvedPublic. Actions.
Read more >Node.js v19.3.0 Documentation
doesNotThrow(fn[, error][, message]); assert.equal(actual, expected[, message]) ... Functions to convert from C types to Node-API ... parseArgs tokens.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ensure your node version is >=7.6.0
this is okay