# Module not found error when including TemplateVisType class

**URL:** <https://discuss.elastic.co/t/module-not-found-error-when-including-templatevistype-class/57586>\
**Category:** Kibana\
**Created:** [August 9, 2016, 11:30am UTC](https://discuss.elastic.co/t/module-not-found-error-when-including-templatevistype-class/57586 "2016-08-09T11:30:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![YuWatanabe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuwatanabe/32/13259_2.png) [@YuWatanabe](https://discuss.elastic.co/u/YuWatanabe)\
**Post date:** [August 9, 2016, 11:30am UTC](https://discuss.elastic.co/t/module-not-found-error-when-including-templatevistype-class/57586/1 "2016-08-09T11:30:11Z")

</div>

Hi!

I am now building custom visualization plugin on kibana and  
I would like to ask question about custom visualization.

My environment is kibana alpha5.0.0-alpha5.  
I have used `git clone https://github.com/elastic/kibana.git`  
when I created kibana environment.

I am getting below error when I try to access kibana from the browser.

```
ERROR in ./plugins/access/public/agg.js
Module not found: Error: Cannot resolve 'file' or 'directory' /home/hoge/dev/kibana/src/ui/public/template_vis_type/TemplateVisType in /home/hoge/dev/kibana/plugins/access/public
 @ ./plugins/access/public/agg.js 4:32-79

at Object.exports.create (/home/creationline/dev/kibana/node_modules/boom/lib/index.js:21:17)
at LazyOptimizer.failedStatsToError (/home/creationline/dev/kibana/src/optimize/base_optimizer.js:201:17)
at Compiler.<anonymous> (/home/creationline/dev/kibana/src/optimize/lazy/lazy_optimizer.js:44:22)
at Compiler.applyPlugins (/home/creationline/dev/kibana/node_modules/tapable/lib/Tapable.js:26:37)
at Watching._done (/home/creationline/dev/kibana/node_modules/webpack/lib/Compiler.js:78:17)
at Watching.<anonymous> (/home/creationline/dev/kibana/node_modules/webpack/lib/Compiler.js:51:17)
at /home/creationline/dev/kibana/node_modules/webpack/lib/Compiler.js:403:12
at Compiler.next (/home/creationline/dev/kibana/node_modules/tapable/lib/Tapable.js:67:11)
at Compiler.<anonymous> (/home/creationline/dev/kibana/node_modules/webpack/lib/CachePlugin.js:40:4)
at Compiler.applyPluginsAsync (/home/creationline/dev/kibana/node_modules/tapable/lib/Tapable.js:71:13)
at Compiler.<anonymous> (/home/creationline/dev/kibana/node_modules/webpack/lib/Compiler.js:400:9)
at Compilation.<anonymous> (/home/creationline/dev/kibana/node_modules/webpack/lib/Compilation.js:576:13)
at Compilation.applyPluginsAsync (/home/creationline/dev/kibana/node_modules/tapable/lib/Tapable.js:60:69)
at Compilation.<anonymous> (/home/creationline/dev/kibana/node_modules/webpack/lib/Compilation.js:571:10)
at Compilation.applyPluginsAsync (/home/creationline/dev/kibana/node_modules/tapable/lib/Tapable.js:60:69)
at Compilation.<anonymous> (/home/creationline/dev/kibana/node_modules/webpack/lib/Compilation.js:566:9)
Error: Optimizations failure.

```

I have wrote my "aggs.js" under public directory as below.

```
function AggProvider(Private) {
  var TemplateVisType = Private(require('ui/template_vis_type/TemplateVisType'));

  return new TemplateVisType({
    name: 'agg',
    title: 'Sample Aggregation',
    icon : 'fa-cloud',
    description : 'Sample backend aggregation for kibana',
    requiresSearch : true,
    template : require('plugins/access/agg.html')
  });
}

```

Do I have anything wrong with my Private() ?

---

<div class="post-metadata">

**Author:** ![BigFunger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bigfunger/32/7323_2.png) [@BigFunger](https://discuss.elastic.co/u/BigFunger)\
**Post date:** [August 9, 2016, 2:36pm UTC](https://discuss.elastic.co/t/module-not-found-error-when-including-templatevistype-class/57586/2 "2016-08-09T14:36:36Z")

</div>

Shouldn't:

`var TemplateVisType = Private(require('ui/template_vis_type/TemplateVisType'));`

be

`var TemplateVisType = Private(require('ui/template_vis_type/template_vis_type'));`

?

I think in this case, the error message was right on the money. 😉

---

<div class="post-metadata">

**Author:** ![YuWatanabe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuwatanabe/32/13259_2.png) [@YuWatanabe](https://discuss.elastic.co/u/YuWatanabe)\
**Post date:** [August 10, 2016, 2:39am UTC](https://discuss.elastic.co/t/module-not-found-error-when-including-templatevistype-class/57586/3 "2016-08-10T02:39:55Z")

</div>

Error is gone now.

Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:41pm UTC](https://discuss.elastic.co/t/module-not-found-error-when-including-templatevistype-class/57586/4 "2017-07-06T13:41:29Z")

</div>


