Kibana Source Installation gives Npm Error

Hi!

i was working on kibana source installation and i went through the following steps:
Install git from yum
I installed Node.Js from https://nodejs.org/download/release/latest/
3.git clone https://github.com/elastic/kibana.git kibana
Installed NVM from curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
nvm install "$(cat .node-version)"
npm install
npm run elasticsearch
and then i got npm errors

npm run elasticsearch
npm ERR! Linux 3.10.0-327.el7.x86_64
npm ERR! argv "/root/.nvm/versions/node/v7.10.0/bin/node" "/root/.nvm/versions/node/v7.10.0/bin/npm" "run" "elasticsearch"
npm ERR! node v7.10.0
npm ERR! npm v4.2.0
npm ERR! path /root/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open '/root/package.json'
npm ERR! enoent ENOENT: no such file or directory, open '/root/package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR! /root/.npm/_logs/2017-05-08T15_10_31_611Z-debug.log

here is log file details:
tail -f /root/kibana/KIBANA/npm-debug.log
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 ]

i have come up with 3 suggestion after searching nearly 20 different links, 1) deleting esvm dir 2) degarding node version and 3) running "npm install grunt -keep alive --save-dev, but neither of these helped me!

1 Like

@FareehaNaaz do you have java installed and in your PATH as well? If you run java -version what do you see?

$ java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) Server VM (build 25.102-b14, mixed mode)

@FareehaNaaz you need to have your current working directory set to kibana (cd kibana) before running:

nvm install "$(cat .node-version)"
npm install
npm run elasticsearch

yeah i did the same

@FareehaNaaz the following error alludes to you having your current working directory at "/root"

npm ERR! enoent ENOENT: no such file or directory, open '/root/package.json'

did you git clone the source into "/root" I'm thinking it put it in "/root/kibana"

pwd

/home/elk/KIBANA
[root@pdc-prd-dbware36 KIBANA]# npm run elasticsearch

kibana@6.0.0-alpha1 elasticsearch /home/elk/KIBANA
grunt esvm:dev:keepalive

Loading "Gruntfile.js" tasks...ERROR

SyntaxError: Unexpected token {
Warning: Task "esvm:dev:keepalive" not found. Use --force to continue.

Aborted due to warnings.

npm ERR! Linux 2.6.32-279.el6.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "elasticsearch"
npm ERR! node v4.4.0
npm ERR! npm v2.14.20
npm ERR! code ELIFECYCLE
npm ERR! kibana@6.0.0-alpha1 elasticsearch: grunt esvm:dev:keepalive
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the kibana@6.0.0-alpha1 elasticsearch script 'grunt esvm:dev:keepalive'.
npm ERR! This is most likely a problem with the kibana package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! grunt esvm:dev:keepalive
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs kibana
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls kibana
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/elk/KIBANA/npm-debug.log

@FareehaNaaz do you have any pending changes? If you run git status what do you get?

i get this:

git status

On branch master
Changed but not updated:
(use "git add ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)

modified:   package.json

Untracked files:
(use "git add ..." to include in what will be committed)

npm

no changes added to commit (use "git add" and/or "git commit -a")

Did you intend to make changes to the package.json? It'd be helpful for you to undo your changes and try again. If you run git checkout . it should reset the changes that you made.

i havnt made any changes, but still i gave it a try and here is the o/p

git checkout

M package.json
[root@pdc-prd-dbware36 KIBANA]# npm run elasticsearch

kibana@6.0.0-alpha1 elasticsearch /home/elk/KIBANA
grunt esvm:dev:keepalive

Loading "Gruntfile.js" tasks...ERROR

SyntaxError: Unexpected token {
Warning: Task "esvm:dev:keepalive" not found. Use --force to continue.

Aborted due to warnings.

npm ERR! Linux 2.6.32-279.el6.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "elasticsearch"
npm ERR! node v4.4.0
npm ERR! npm v2.14.20
npm ERR! code ELIFECYCLE
npm ERR! kibana@6.0.0-alpha1 elasticsearch: grunt esvm:dev:keepalive
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the kibana@6.0.0-alpha1 elasticsearch script 'grunt esvm:dev:keepalive'.
npm ERR! This is most likely a problem with the kibana package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! grunt esvm:dev:keepalive
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs kibana
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls kibana
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/elk/KIBANA/npm-debug.log

It looks like your node version switched back to v4.4.0, nvm use/nvm install isn't persistent across multiple terminals, you'll want to run nvm use "$(cat .node-version)" every-time that you open up a new terminal or investigate using (avn)[https://www.npmjs.com/package/avn] to do so automatically.

Additionally, please be certain that you ran "git checkout ." and it doesn't show the package.json as modified when you run "git status", i'm afraid there are still pending changes there based on:

M	package.json

that M to the left generally means "Modified"

i did follow these steps and then here is what i get:

npm run elasticsearch

kibana@6.0.0-alpha1 elasticsearch /root/kibana/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 - ? - ? - [2017-05-18T14:28:32,247][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] uncaught exception in thread [main]
INFO - ? - ? - org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
INFO - ? - ? - at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:127) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - Caused by: java.lang.RuntimeException: can not run elasticsearch as root
INFO - ? - ? - at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:104) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:180) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - ... 6 more
Fatal error: Server exitted with the non-zero exit code 1

npm ERR! Linux 2.6.32-279.el6.x86_64
npm ERR! argv "/root/.nvm/versions/node/v6.10.2/bin/node" "/root/.nvm/versions/node/v6.10.2/bin/npm" "run" "elasticsearch"
npm ERR! node v6.10.2
npm ERR! npm v3.10.10
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,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! grunt esvm:dev:keepalive
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs kibana
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls kibana
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /root/kibana/KIBANA/npm-debug.log

@FareehaNaaz

INFO - ? - ? - org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

1 Like

hi! i have tried the same steps in another box through root user, but then i get this:

npm run elasticsearch

kibana@6.0.0-alpha1 elasticsearch /root/kibana/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 - ? - ? - [2017-05-18T17:45:31,147][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] uncaught exception in thread [main]
INFO - ? - ? - org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
INFO - ? - ? - at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:127) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - Caused by: java.lang.RuntimeException: can not run elasticsearch as root
INFO - ? - ? - at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:104) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:180) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - ... 6 more
Fatal error: Server exitted with the non-zero exit code 1

npm ERR! Linux 2.6.32-279.el6.x86_64
npm ERR! argv "/root/.nvm/versions/node/v6.10.2/bin/node" "/root/.nvm/versions/node/v6.10.2/bin/npm" "run" "elasticsearch"
npm ERR! node v6.10.2
npm ERR! npm v3.10.10
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,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! grunt esvm:dev:keepalive
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs kibana
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls kibana
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /root/kibana/KIBANA/npm-debug.log

I'm seeing that same error, saying you can't run Elasticsearch as root. Have you tried creating another user, logging in as that user and then trying to run npm run elasticsearch?

yes created a user with root permissions and then "npm run elasticsearch", still i get the same errors.

@FareehaNaaz

Elasticsearch is calling the native Linux syscall geteuid to determine if the user is root. Are you running the command using sudo? That will trigger that check as well.

i did try by logging as my new user/ switching to my new user before running npm and also by giving sudo but all give the same error, here are my userid, group details:

id sraha

uid=0(root) gid=0(root) groups=0(root),10(wheel)

@FareehaNaaz I'm not following, the uid and gid of that user appear to be root, so Elasticsearch is going to think that you're root.