holmari / gerritstats

Tool for creating statistics from a Gerrit repository
MIT License
193 stars 54 forks source link

Build Failure on Ubuntu 14.04 #32

Open bluepeach opened 7 years ago

bluepeach commented 7 years ago

I'm trying to build gerritstats by following the readme on ubuntu 14.04.

It first complained that npm wasn't installed, so I apt-get'ed it.

It then complained that node wasn't installed, so I apt-get'ed it too

It then fails with:

npm http GET https://registry.npmjs.org/inherits npm http 304 https://registry.npmjs.org/inherits npm http 304 https://registry.npmjs.org/block-stream

node-sass@3.14.0-0 install /home/rschmitt/git/gerritstats/GerritStats/node_modules/node-sass node scripts/install.js

npm WARN This failure might be due to the use of legacy binary "node" npm WARN For further explanations, please read /usr/share/doc/nodejs/README.Debian

npm ERR! weird error 1 npm ERR! not ok code 0 :GerritStats:npmInstall FAILED

FAILURE: Build failed with an exception.

It might be due to legacy node, since it says it's replaced with nodejs. But nodejs is installed. So, I don't know. Does any of this sound familiar?

Rich

holmari commented 7 years ago

I don't know if this helps since I don't have Ubuntu 14.04, but check this out: https://stackoverflow.com/questions/21168141/cannot-install-packages-using-node-package-manager-in-ubuntu

bluepeach commented 7 years ago

Thanks for your reply, and it looked promising. Unfortunately, there are other compatibility issues too. The next one we run into is:

const Hoek = require('hoek'); ^^^^^ SyntaxError: Use of const in strict mode.

Looking around on the web, it seems this might be out of joi and the maintainer says he doesn't support legacy anymore.

Are there plans to support nodejs directly?

bluepeach commented 7 years ago

Ok, got past the previous error by installing version 8.5 of nodejs.

Now I have another issue. The build with gradlew completes successfully. I can run the gerrit_download.sh script. I get an error when running the gerrit_stats.sh script.

I've been looking at this most of the day and believe this is turning out to be something with webpack. I'm hoping this looks familiar with someone.

gerritstats@1.0.0 webpack /home/rschmitt/git/gerritstats/GerritStats webpack --display-error-details --colors --progress --config webpack.config.js Hash: f1817f83ea7482e48620 Version: webpack 1.15.0 Time: 20910ms Asset Size Chunks Chunk Names 4713eef7edb06b1e8b4e1e4a6c489a5c.png 19.8 kB [emitted] a3b60647ef11633dfce07443e8ebcc56.png 19.8 kB [emitted] bundle.js 3.04 MB 0 [emitted] main

ERROR in getOptions is not defined @ ./src/main/frontend/index.jsx 3:0-43

There are many more of those ERROR in getOptions in the output.

This is crossposted to a webpack mailing list as well. Any ideas?

holmari commented 6 years ago

@bluepeach is this still an issue? I see you have also filed https://github.com/webpack/loader-utils/issues/99 .

connectedway commented 6 years ago

(this is @bluepeach)

Well, it probably still is an issue. I worked on it a bit more and then just decided to move on to other things. I was hoping to use it though to get status from our gerrit projects. Figured I'd wait for some future release and try again.

ssbarnea commented 6 years ago

We could also rephrase the bug to "it doesn't build anymore on most platforms". Also tried RHEL, Fedora and MacOS, broken on all of them.

butterl commented 6 years ago

@bluepeach @holmari I build with ubuntu 16.04 LTS and node v8.5, it keeps looking for v3.13.1/linux-x64-57_binding.node but this really not exist on github, do you got any idea on it?

13:33:57.847 [QUIET] [system.out] > node-sass@3.13.1 install /home/test/code/gerritstats/GerritStats/node_modules/node-sass
13:33:57.847 [QUIET] [system.out] > node scripts/install.js
13:33:57.847 [QUIET] [system.out]
13:33:58.079 [QUIET] [system.out] Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/linux-x64-57_binding.node
13:34:00.815 [ERROR] [system.err] Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/linux-x64-57_binding.node":
13:34:00.816 [ERROR] [system.err]
13:34:00.816 [ERROR] [system.err] HTTP error 404 Not Found
13:34:00.816 [ERROR] [system.err]
13:34:00.816 [ERROR] [system.err] Hint: If github.com is not accessible in your location
13:34:00.816 [ERROR] [system.err]       try setting a proxy via HTTP_PROXY, e.g.
13:34:00.817 [ERROR] [system.err]
13:34:00.817 [ERROR] [system.err]       export HTTP_PROXY=http://example.com:1234
13:34:00.817 [ERROR] [system.err]
13:34:00.817 [ERROR] [system.err] or configure npm proxy via
13:34:00.818 [ERROR] [system.err]
13:34:00.818 [ERROR] [system.err]       npm config set proxy http://example.com:8080
james-nesbitt commented 6 years ago

OK, so I am not using Ubuntu, but here are some instructions on how I got this to build on Linux. A quick warning is that it ain't pretty.

First off, a better list of dependencies:

  1. libsass -> to render sass to css
  2. g++ -> which is used by node-gyp to build a library based on libsass for your platform
  3. npm (Mine was version 6.5.0) or yarn (mine was 1.7.0)

What we are going to do is separate the build into 2 steps. The node build for GerritStats, and the Application build from root. To do that we will disable the Gradle npm dependency, and then just handle it ourselves.

A. Node stuff

In the GerritStats folder, and run run npm update (or yarn update) instead of running npm install. This doesn't just install the dependencies as listed in the package-lock.json file, but checks for platform related updates - which is what is killing the npm for me. If this finishes, then you are good. If this doesn't finish, it will give you a much better error output than gradle does, so you can actually diagnose the error.

Note that I tried several different approaches with inconsistent results, but suffice it to say, if you can get npm/yarn to finish, then you can move on.

B Gradle run

Edit the file /GerritStats/build.gradlew and comment out that line the says processResources.dependsOn npmInstall by putting // in front of it. Then run the gradle wrapper as instructed in the README: ./gradlew assemble

DONE

Why does this fix it?

Well the older npm version delcared in the package-lock.json, which might make sense for MacOS, actually causes issues on other platforms, as newer versions have fixed a number of threading/dependency issues. If you get the ENOENT error related so {something}.DELETE, then you are getting this issue. Some people get this error when using Visual-Code, which appears to be competing for file resources.

@holmari is you are interested, I will submit a PR with an updated package-lock.json

holmari commented 6 years ago

@james-nesbitt, happy to accept any PRs. I'm sorry I don't have time to actively maintain this project, I'm not using Gerrit anymore at my current workplace.