Failed to build kibana 5.3.1 from source

Hi All,

When i tried to build kibana binary from source am facing issue while running command "npm run build"

Followed steps which are mentioned in https://github.com/elastic/kibana/blob/5.x/CONTRIBUTING.md

npm install executed successfully.

When i tried with "npm run build" am getting below error.

Warning: Client request error: connect EHOSTUNREACH 104.20.22.46:443 Use --force to continue.

Aborted due to warnings.

npm ERR! Linux 3.10.0-327.el7.x86_64
npm ERR! argv "/root/.nvm/versions/node/v6.10.2/bin/node" "/root/.nvm/versions/node/v6.10.2/bin/npm" "run" "build" "--debug"
npm ERR! node v6.10.2
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! kibana@5.3.3 build: grunt build
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the kibana@5.3.3 build script 'grunt build'.
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 build
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! /kibana/npm-debug.log

Am i missing something here?
My requirement is to get the kibana rpm/binary from the source code.

Can you run with npm run build -- --debug and paste the output? Maybe it will give us some extra information.

Hello Thanks for the response.Even i tried with --debug but logs are same in both.Anyway i pasted complete log below.
bash-4.2# npm run build -- --debug

kibana@5.3.3 build /kibana
grunt build "--debug"

Running "build" task
[D] Task source: tasks/build/index.js

Running "clean:build" (clean) task
[D] Task source: /kibana/node_modules/grunt-contrib-clean/tasks/clean.js

0 paths cleaned.

Running "clean:target" (clean) task
[D] Task source: /kibana/node_modules/grunt-contrib-clean/tasks/clean.js

0 paths cleaned.

Running "_build:downloadNodeBuilds" task
[D] Task source: tasks/build/download_node_builds.js
Warning: Client request error: connect EHOSTUNREACH 104.20.22.46:443 Use --force to continue.

Aborted due to warnings.

npm ERR! Linux 3.10.0-327.el7.x86_64
npm ERR! argv "/root/.nvm/versions/node/v6.10.2/bin/node" "/root/.nvm/versions/node/v6.10.2/bin/npm" "run" "build" "--" "--debug"
npm ERR! node v6.10.2
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! kibana@5.3.3 build: grunt build "--debug"
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the kibana@5.3.3 build script 'grunt build "--debug"'.
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 build "--debug"
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! /kibana/npm-debug.log

Thank You

Looks like this is what is causing the failure. Do you have access to an internet connection?

I guess that's a stupid question since you are here responding to me. Doh! :slight_smile:

1 Like

yes i do have an access to internet connection in my environment.I set proxy even with 'npm config set "proxy....." '

Does npm i work?

Yup It worked fine to me.But observed it skipped few optional dependencies.I believe that should be fine.
FYI,
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","ar

Can you hit the url directly? Try https://nodejs.org/dist/v6.10.2/node-v6.10.2-darwin-x64.tar.gz

Am able to wget https://nodejs.org/dist/v6.10.2/node-v6.10.2-darwin-x64.tar.gz
it downloads the tar file. Is that the one your talking about?

Hmmm, do you need the npm config set proxy call? Are you behind a proxy?

What happens if you delete it (npm config delete proxy) and try the build again?

Initially i tried without setting proxy through npm config But i faced same error.

Can you build master or does the problem only exist on 5.3.1? Does npm start work?

I did tried it on build master as well but faced same issue.Looks like The issue is the proxy and the use of wreck.Am still trying to figure out the fix.

npm run elasticsearch and npm start doesn't work for me.

bash-4.2# npm run elasticsearch

kibana@6.0.0-alpha2 elasticsearch /kibana
grunt esvm:dev:keepalive

Loading "ui_framework.js" tasks...ERROR

Error: ENOENT: no such file or directory, scandir '/kibana/node_modules/node-sass/vendor'

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
ERROR - - cluster - malformed log message: "/kibana/esvm/dev/branch-master/bin/elasticsearch: line 155: hostname: command not found"
INFO - ? - ? - [2017-05-17T12:59:02,920][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 3.10.0-327.el7.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

bash-4.2# npm start

kibana@6.0.0-alpha2 start /kibana
sh ./bin/kibana --dev

watching for changes (355 files)
optmzr log [12:55:32.443] [info][status][ui settings] Status changed from uninitialized to disabled - uiSettings.enabled config is set to false
server log [12:55:32.582] [info][optimize] Waiting for optimizer completion
optmzr log [12:55:32.660] [info][optimize] Lazy optimization of bundles for kibana, stateSessionStorageRedirect, timelion, sense-tests and status_page ready
optmzr log [12:55:32.665] [info][optimize] Lazy optimization started
optmzr log [12:55:32.688] [info] Plugin initialization disabled.
server log [12:55:32.800] [info][status][plugin:kibana@6.0.0-alpha2] Status changed from uninitialized to green - Ready
server log [12:55:32.881] [info][status][plugin:elasticsearch@6.0.0-alpha2] Status changed from uninitialized to yellow - Waiting for Elasticsearch
server log [12:55:32.910] [error][admin][elasticsearch] Request error, retrying
HEAD http://localhost:9200/ => connect ECONNREFUSED 127.0.0.1:9200
server log [12:55:32.913] [info][status][plugin:console@6.0.0-alpha2] Status changed from uninitialized to green - Ready
server log [12:55:32.918] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
server log [12:55:32.919] [warning][admin][elasticsearch] No living connections
server log [12:55:32.924] [error][status][plugin:elasticsearch@6.0.0-alpha2] Status changed from yellow to red - Unable to connect to Elasticsearch at http://localhost:9200.
server log [12:55:32.944] [info][status][plugin:metrics@6.0.0-alpha2] Status changed from uninitialized to green - Ready
server log [12:55:34.421] [info][status][plugin:timelion@6.0.0-alpha2] Status changed from uninitialized to green - Ready
server log [12:55:34.428] [info][listening] Server running at https://localhost:5603
server log [12:55:34.430] [error][status][ui settings] Status changed from uninitialized to red - Elasticsearch plugin is red
server log [12:55:35.428] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
server log [12:55:35.431] [warning][admin][elasticsearch] No living connections
server log [12:55:37.940] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
server log [12:55:37.940] [warning][admin][elasticsearch] No living connections

Is it mandatory to run elasticsearch and npm start before building kibana?

No. npm run elasticsearch starts up an elasticsearch instance for Kibana to run against which can help with development so you don't have to kick up an es instance separately. You'll need to have some elasticsearch instance to run against, but it doesn't have to be by the command npm run elasticsearch. For instance, I have the elasticsearch repo checked out and run gradle run in that folder to start an instance.

npm start starts Kibana without building any binaries, while npm run build will create the binaries you can then use to run Kibana.

I was asking only to see if the error was more widespread or only with the build process.

Regarding the error:

Error: ENOENT: no such file or directory, scandir '/kibana/node_modules/node-sass/vendor'

Sounds like npm install did not finish correctly - that folder should be in your node_modules as a result of that call.

Hi,

Thanks a lot for your response for my queries.Finally am able to build the kibana successfully.
Referred https://github.com/hapijs/wreck/issues/64 (one of my team member suggested)
Workaround to fix this issues.

From the source code need to modify the kibana/tasks/build/download_node_builds.js
file.

Delete:
import wreck from 'wreck';

Add:
const Wreck = require('wreck');
const HttpProxyAgent = require('https-proxy-agent');
const proxy = process.env.https_proxy || 'http://127.0.0.1:80'; // this is placeholder logic
const agent = new HttpProxyAgent(proxy);
const wreck = Wreck.defaults({
agent
});

Then i tried to execute "npm run build" and am able to proceed further.

Thanks,
Ravi

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