# Moment erorr in kibana dev env

**URL:** <https://discuss.elastic.co/t/moment-erorr-in-kibana-dev-env/78433>\
**Category:** Kibana\
**Created:** [March 14, 2017, 2:01am UTC](https://discuss.elastic.co/t/moment-erorr-in-kibana-dev-env/78433 "2017-03-14T02:01:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![whoami](https://avatars.discourse-cdn.com/v4/letter/w/a9a28c/32.png) [@whoami](https://discuss.elastic.co/u/whoami)\
**Post date:** [March 14, 2017, 2:01am UTC](https://discuss.elastic.co/t/moment-erorr-in-kibana-dev-env/78433/1 "2017-03-14T02:01:02Z")

</div>

PSP: everything is ok in non-dev mode

after `npm install`, then I run `./bin/kibana --dev --no-ssl --no-base-path`, after I refresh the chrome, I got below error later:

```auto
 WARNING in ./~/.2.13.0@moment/min/moment.min.js
    Module not found: Error: Cannot resolve 'file' or 'directory' ./locale in /Users/whoami/kibana/kibana/node_modules/.2.13.0@moment/min
     @ ./~/.2.13.0@moment/min/moment.min.js 6:3763-3785

    at Object.exports.create (/Users/whoami/kibana/kibana/node_modules/.2.8.0@boom/lib/index.js:21:17)
    at LazyOptimizer.failedStatsToError (/Users/whoami/kibana/kibana/src/optimize/base_optimizer.js:214:17)
    at Compiler.<anonymous> (/Users/whoami/kibana/kibana/src/optimize/lazy/lazy_optimizer.js:44:22)
    at Compiler.applyPlugins (/Users/whoami/kibana/kibana/node_modules/.0.1.10@tapable/lib/Tapable.js:26:37)
    at Watching._done (/Users/whoami/kibana/kibana/node_modules/.1.12.15@webpack/lib/Compiler.js:78:17)
    at Watching.<anonymous> (/Users/whoami/kibana/kibana/node_modules/.1.12.15@webpack/lib/Compiler.js:61:18)
    at /Users/whoami/kibana/kibana/node_modules/.4.1.11@graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:123:15)
Error: Optimizations failure.

```

I found some snippet in moment.js source:

```auto
    function loadLocale(name) {
        var oldLocale = null;
        // TODO: Find a better way to register and load all the locales in Node
        if (!locales[name] && (typeof module !== 'undefined') &&
                module && module.exports) {
            try {
                oldLocale = globalLocale._abbr;
                require('./locale/' + name);
                // because defineLocale currently also sets the global locale, we
                // want to undo that for lazy loaded locales
                locale_locales__getSetGlobalLocale(oldLocale);
            } catch (e) { }
        }
        return locales[name];
    }

```

seems kibana use moment.min.js (in moment/min), but there is no `locale` in moment/min, should kibana use `moment-with-locales.min.js` instead?

it seems its a bug? [https://github.com/moment/moment/issues/1435](https://github.com/moment/moment/issues/1435)

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [March 14, 2017, 12:30pm UTC](https://discuss.elastic.co/t/moment-erorr-in-kibana-dev-env/78433/2 "2017-03-14T12:30:18Z")

</div>

Hi @whoami,

Could you tell me which branch and commit SHA of Kibana you are working with? That way I can try to reproduce your error and investigate further.

Thanks,

Shaunak

---

<div class="post-metadata">

**Author:** ![whoami](https://avatars.discourse-cdn.com/v4/letter/w/a9a28c/32.png) [@whoami](https://discuss.elastic.co/u/whoami)\
**Post date:** [March 16, 2017, 1:40am UTC](https://discuss.elastic.co/t/moment-erorr-in-kibana-dev-env/78433/3 "2017-03-16T01:40:39Z")

</div>

kibana 5.2.0:

git clone `kibana`  
npm install  
./bin/kibana --dev --no-ssl --no-base-path

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [March 17, 2017, 4:11pm UTC](https://discuss.elastic.co/t/moment-erorr-in-kibana-dev-env/78433/4 "2017-03-17T16:11:31Z")

</div>

Hi @whoami,

I just tried to reproduce your issue with the `5.2` branch but was unsuccessful.

I ran `npm ls | grep moment` and got this output:

```auto
├── moment@2.13.0
├── moment-timezone@0.5.4

```

What output do you get if you run the same command?

---

<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:** [April 14, 2017, 4:11pm UTC](https://discuss.elastic.co/t/moment-erorr-in-kibana-dev-env/78433/5 "2017-04-14T16:11:30Z")

</div>

Closed on April 14, 2017, 4:11pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
