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.

this.render is not a function

See original GitHub issue

I’m using koa@2 and getting _this.render is not a function

this.render('index')

Doing ctx.render does work but I need to specify ‘index.pug’ and not just ‘index’. Also, not if it is related but string interpolation no longer works.

p.text-xs-center $ #{product.price}

Just outputs #{product.price} after it’s converted to html.

package.json
{
  "koa": "^2.0.0",
  "koa-pug": "^3.0.0-0"
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
chrisyipcommented, May 7, 2016

koa-pug is not fully support koa@2 yet, though it can work.

  1. koa@2 uses ctx instead of this for context of one request, please use ctx.render instead: https://github.com/koajs/koa/tree/v2.x#old-signature-middleware-v1x---deprecated .
  2. About .pug extname and string interpolation, can you post your codes? I can’t reproduce these issues.
0reactions
chrisyipcommented, May 10, 2016

It is a bug of Pug, and fixed in alpha7: https://github.com/pugjs/pug/commit/2d79b88c9b4e37f1593c6d2ec7c79104df1b7c68 .

There’re two solutions:

  • If you’re using npm ^3.7, you can run npm i pug@2.0.0-alpha7
  • Reinstall koa-pug, npm will install latest Pug for you.
Read more comments on GitHub >

github_iconTop Results From Across the Web

React Context: TypeError: render is not a function
The problem is I seem to be getting an error 'TypeError: render is not a function. (In render(newValue), render is an instance of...
Read more >
render is not a function????? (Example) - Treehouse
render is not a function ????? I am try Use Context API but having this Strange error. Context/index.js. const AmazonContext = React.
Read more >
Scene.render() is not a function - Questions - Babylon.js Forum
I just copied an example on Playground and pasted it on my editor to run it on local, but it keeps saying “scene.render()...
Read more >
The child node of a React context consumer ... - DeepScan
The child node of a context consumer should be a function that takes the current context ... (TypeError: render is not a function)...
Read more >
document.getElementById(...).render is not a function - React.js
I wasted again another hour of my life finding this solution.
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