node.jsexpressnestjs

Failed to lookup view "index" in views directory NestJs


I am getting the following error from nestjs:

Failed to lookup view "index" in views directory "/api/dist/views"

I am trying to use handlebars templating engine with NestJs. I have followed the NestJs documentation here directly without changing a thing. For some weird reason i still get the same error.

I have even created a fresh project using the nestjs cli, followed the direction in the documentation above and still getting thesame error.

I have also followed the help in this stackoverflow answer here and added "assets": ["**/*.hbs"] to my nest-cli.json at the root of the project. Still getting thesame error.

Can anyone help me please? or Has anyone experienced this or is it just me?


Solution

  • It should be "include": "../views" in nest-cli.json file now

      "compilerOptions": {    
        "assets": [
          {
            "include": "../views",
            "outDir": "dist/views",
            "watchAssets": true
          }
        ]
      }