# Npm run elasticsearch: Fatal error: Cannot read property 'master' of undefined

**URL:** <https://discuss.elastic.co/t/npm-run-elasticsearch-fatal-error-cannot-read-property-master-of-undefined/67959>\
**Category:** Kibana\
**Created:** [December 4, 2016, 7:57pm UTC](https://discuss.elastic.co/t/npm-run-elasticsearch-fatal-error-cannot-read-property-master-of-undefined/67959 "2016-12-04T19:57:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cstock89](https://avatars.discourse-cdn.com/v4/letter/c/eada6e/32.png) [@cstock89](https://discuss.elastic.co/u/cstock89)\
**Post date:** [December 4, 2016, 7:57pm UTC](https://discuss.elastic.co/t/npm-run-elasticsearch-fatal-error-cannot-read-property-master-of-undefined/67959/1 "2016-12-04T19:57:10Z")

</div>

Hi all,

I am trying to build up a kibana development environment as described [here](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#development-environment-setup) and forked, then cloned the kibana [repo](https://github.com/cstock89/kibana-master.git). I´ve set up the development environment until it was failing at "npm run elasticsearch" step. I have already searched for a solution without any result. Therefore I appreciate any support. Thank you in advance.

Here is the trace log:

```auto
0 info it worked if it ends with ok
1 verbose cli [ '/home/caesar/.nvm/versions/node/v6.9.0/bin/node',
1 verbose cli '/home/caesar/.nvm/versions/node/v6.9.0/bin/npm',
1 verbose cli 'run',
1 verbose cli 'elasticsearch' ]
2 info using npm@3.10.8
3 info using node@v6.9.0
4 verbose run-script ['preelasticsearch', 'elasticsearch', 'postelasticsearch']
5 info lifecycle kibana@6.0.0-alpha1~preelasticsearch: kibana@6.0.0-alpha1
6 silly lifecycle kibana@6.0.0-alpha1~preelasticsearch: no script for preelasticsearch, continuing
7 info lifecycle kibana@6.0.0-alpha1~elasticsearch: kibana@6.0.0-alpha1
8 verbose lifecycle kibana@6.0.0-alpha1~elasticsearch: unsafe-perm in lifecycle true
9 verbose lifecycle kibana@6.0.0-alpha1~elasticsearch: PATH: /home/caesar/.nvm/versions/node/v6.9.0/lib/node_modules/npm/bin/node-gyp-bin:/home/caesar/kibana/node_modules/.bin:/home/caesar/.nvm/versions/node/v6.9.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/caesar/bin:/usr/lib/jvm/java-8-oracle/bin
10 verbose lifecycle kibana@6.0.0-alpha1~elasticsearch: CWD: /home/caesar/kibana
11 silly lifecycle kibana@6.0.0-alpha1~elasticsearch: Args: ['-c', 'grunt esvm:dev:keepalive']
12 silly lifecycle kibana@6.0.0-alpha1~elasticsearch: Returned: code: 1 signal: null
13 info lifecycle kibana@6.0.0-alpha1~elasticsearch: Failed to exec elasticsearch script
14 verbose stack Error: kibana@6.0.0-alpha1 elasticsearch: `grunt esvm:dev:keepalive`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/home/caesar/.nvm/versions/node/v6.9.0/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (/home/caesar/.nvm/versions/node/v6.9.0/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:877:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid kibana@6.0.0-alpha1
16 verbose cwd /home/caesar/kibana
17 error Linux 3.16.0-4-amd64
18 error argv "/home/caesar/.nvm/versions/node/v6.9.0/bin/node" "/home/caesar/.nvm/versions/node/v6.9.0/bin/npm" "run" "elasticsearch"
19 error node v6.9.0
20 error npm v3.10.8
21 error code ELIFECYCLE
22 error kibana@6.0.0-alpha1 elasticsearch: `grunt esvm:dev:keepalive`
22 error Exit status 1
23 error Failed at the kibana@6.0.0-alpha1 elasticsearch script 'grunt esvm:dev:keepalive'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the kibana package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error grunt esvm:dev:keepalive
23 error You can get information on how to open an issue for this project with:
23 error npm bugs kibana
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls kibana
23 error There is likely additional logging output above.
24 verbose exit [1, true]

```

Here is the command prompt:

```auto
npm run elasticsearch

> kibana@6.0.0-alpha1 elasticsearch /home/caesar/kibana
> grunt esvm:dev:keepalive

Running "esvm:dev:keepalive" (esvm) task
starting up "dev" cluster
Keeping elasticsearch alive, to shutdown press command/control+c
Fatal error: Cannot read property 'master' of undefined

npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/home/caesar/.nvm/versions/node/v6.9.0/bin/node" "/home/caesar/.nvm/versions/node/v6.9.0/bin/npm" "run" "elasticsearch"
npm ERR! node v6.9.0
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! kibana@6.0.0-alpha1 elasticsearch: `grunt esvm:dev:keepalive`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the kibana@6.0.0-alpha1 elasticsearch script 'grunt esvm:dev:keepalive'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the kibana package,

```

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [December 5, 2016, 4:37pm UTC](https://discuss.elastic.co/t/npm-run-elasticsearch-fatal-error-cannot-read-property-master-of-undefined/67959/2 "2016-12-05T16:37:13Z")

</div>

Seems to work OK for me. I'm on Windows and running in a gitbash shell. My output doesn't look like yours.

Did you run `npm install` ? And did that work OK?

My output:

```auto
Lee@LeeD-ASUS MINGW64 /c/git/kibana (master)
$ npm run elasticsearch

> kibana@6.0.0-alpha1 elasticsearch C:\git\kibana
> grunt esvm:dev:keepalive

Running "esvm:dev:keepalive" (esvm) task
starting up "dev" cluster
Keeping elasticsearch alive, to shutdown press command/control+c
INFO - - cluster - Downloading & installing from "master" branch.
INFO - - cluster - Installing plugins
INFO - - cluster - Starting 1 nodes
INFO - - cluster - esvm log level configuration disabled
INFO - ? - ? - [2016-12-05T10:34:33,137][INFO][o.e.n.Node] [] initializing ...
INFO - W9di7m1 - node_environment - using [1] data paths, mounts [[OS (C:)]], net usable_space [15.5gb], net total_space [190.2gb], spins? [unknown], types [NTFS]
INFO - W9di7m1 - node_environment - heap size [1.9gb], compressed ordinary object pointers [true]
INFO - ? - ? - [2016-12-05T10:34:33,244][INFO][o.e.n.Node] node name [W9di7m1] derived from node ID [W9di7m1oRmOYvstN9Vmleg]; set [node.name] to override
INFO - ? - ? - [2016-12-05T10:34:33,320][INFO][o.e.n.Node] version[6.0.0-alpha1-SNAPSHOT], pid[88924], build[32e6fcf/2016-11-23T15:57:31.884Z], OS[Windows 10/10.0/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_73/25.73-b02]
INFO - ? - ? - [2016-12-05T10:34:33,321][WARN][o.e.n.Node] version [6.0.0-alpha1-SNAPSHOT] is a pre-release version of Elasticsearch and is not suitable for production
INFO - W9di7m1 - plugins_service - loaded module [aggs-matrix-stats]
INFO - W9di7m1 - plugins_service - loaded module [ingest-common]
INFO - W9di7m1 - plugins_service - loaded module [lang-expression]
INFO - W9di7m1 - plugins_service - loaded module [lang-mustache]
INFO - W9di7m1 - plugins_service - loaded module [lang-painless]
INFO - W9di7m1 - plugins_service - loaded module [percolator]
INFO - W9di7m1 - plugins_service - loaded module [reindex]
INFO - W9di7m1 - plugins_service - loaded module [transport-netty4]
INFO - W9di7m1 - plugins_service - no plugins loaded
INFO - ? - ? - [2016-12-05T10:34:36,595][INFO][o.e.n.Node] initialized
INFO - W9di7m1 - node - starting ...
INFO - W9di7m1 - transport_service - publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300}
INFO - W9di7m1 - cluster_service - new_master {W9di7m1}{W9di7m1oRmOYvstN9Vmleg}{e6uYfwY1QtWFZM2jX1nS2g}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
INFO - W9di7m1 - gateway_service - recovered [0] indices into cluster_state
INFO - W9di7m1 - http_server - publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}
INFO - W9di7m1 - node - started
>> Started 1 Elasticsearch nodes.
┌──────┬────────────────────────────────────┬───────────┐
│ port │ branch │ node name │
├──────┼────────────────────────────────────┼───────────┤
│ 9200 │ master@32e6fcf (built 12 days ago) │ W9di7m1 │
└──────┴────────────────────────────────────┴───────────┘
WARN - W9di7m1 - disk_threshold_monitor - high disk watermark [90%] exceeded on [W9di7m1oRmOYvstN9Vmleg][W9di7m1][C:\git\kibana\esvm\data_dir\nodes\0] free: 15.5gb[8.1%], shards will be relocated away from this node
INFO - W9di7m1 - disk_threshold_monitor - rerouting shards: [high disk watermark exceeded on one or more nodes]

```

---

<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:** [January 2, 2017, 4:37pm UTC](https://discuss.elastic.co/t/npm-run-elasticsearch-fatal-error-cannot-read-property-master-of-undefined/67959/3 "2017-01-02T16:37:30Z")

</div>

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