I’ve been trying to build 2.3 from source but I’m running into some npm or node issues.
The main graylog2-server builds just fine, but all plugins fail with
[ERROR] sh: webpack: command not found
If I manually copy graylog2-server/graylog2-web-interface/node_modules/* (which includes webpack and the other dependencies such as react) into graylog-plugin-map-widget/node_modules/ (or what ever plugin I’m trying to build) then it builds OK
So it seems like somehow the plugins are not inheriting the dependencies of the main web interface properly?
When I do a build of 2.2 then all plugins compile successfully. I’ve also tried 2.4 and master and they also fail, while 2.2 succeeds.
[WARNING] npm WARN react-leaflet@0.10.2 requires a peer of react@^0.14.0 || ^15.0.0-rc.1 but none was installed.
[WARNING] npm WARN react-leaflet@0.10.2 requires a peer of react-dom@^0.14.0 || ^15.0.0-rc.1 but none was installed.
[WARNING] npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.0.17 (node_modules/graylog-web-plugin/node_modules/fsevents):
[WARNING] npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[INFO]
[INFO] --- frontend-maven-plugin:1.4:npm (npm run build) @ graylog-plugin-map-widget ---
[INFO] Running 'npm run build' in /home/bradley/git/new-build/graylog-project-repos/graylog-plugin-map-widget
[INFO]
[INFO] > MapWidget@2.3.0-SNAPSHOT build /home/bradley/git/new-build/graylog-project-repos/graylog-plugin-map-widget
[INFO] > webpack --bail
[INFO]
[ERROR] sh: webpack: command not found
[ERROR]
[ERROR] npm ERR! Linux 4.13.9-200.fc26.x86_64
[ERROR] npm ERR! argv "/home/bradley/git/new-build/graylog-project-repos/graylog-plugin-map-widget/node/node" "/home/bradley/git/new-build/graylog-project-repos/graylog-plugin-map-widget/node/node_modules/npm/bin/npm-cli.js" "run" "build"
[ERROR] npm ERR! node v6.9.2
[ERROR] npm ERR! npm v4.0.3
[ERROR] npm ERR! file sh
[ERROR] npm ERR! code ELIFECYCLE
[ERROR] npm ERR! errno ENOENT
[ERROR] npm ERR! syscall spawn
[ERROR] npm ERR! MapWidget@2.3.0-SNAPSHOT build: `webpack --bail`
[ERROR] npm ERR! spawn ENOENT
[ERROR] npm ERR!
[ERROR] npm ERR! Failed at the MapWidget@2.3.0-SNAPSHOT build script 'webpack --bail'.
[ERROR] npm ERR! Make sure you have the latest version of node.js and npm installed.
[ERROR] npm ERR! If you do, this is most likely a problem with the MapWidget package,
[ERROR] npm ERR! not with npm itself.
[ERROR] npm ERR! Tell the author that this fails on your system:
[ERROR] npm ERR! webpack --bail
[ERROR] npm ERR! You can get information on how to open an issue for this project with:
[ERROR] npm ERR! npm bugs MapWidget
[ERROR] npm ERR! Or if that isn't available, you can get their info via:
[ERROR] npm ERR! npm owner ls MapWidget
[ERROR] npm ERR! There is likely additional logging output above.
[ERROR]
[ERROR] npm ERR! Please include the following file with any support request:
[ERROR] npm ERR! /home/bradley/git/new-build/graylog-project-repos/graylog-plugin-map-widget/npm-debug.log
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:00.002s
[INFO] Finished at: Fri Nov 10 15:44:56 GMT 2017
[INFO] Final Memory: 24M/143M
[INFO] ------------------------------------------------------------------------
You are right that mvn install behaves differently in the server and plugins. It looks like the plugins’ mvn install does not take care of installing node, npm, and other JS dependencies. You can generate those resources by running mvn generate-resources once after your server is compiled. Also keep in mind that both projects should live in the same directory and have the same version for this task to succeed.
edmundo, I’ve tried running “mvn generate-resources” in the graylog2-server project (where it succeeds) - and in the graylog-plugin-map-widget project, where it also fails with “[ERROR] sh: webpack: command not found”.
jochen,
I’m running Fedora 26. On the same system, a clean checkout of 2.2 (and all plugins) work just fine.
@bradleykite: would you be so kind as to repeat the mvn generate-resources in the map-widget project after removing the node folder in that same directory? And please include the whole log of the command if it fails. In that way we can see if any step was skipped for some reason.
I tried to reproduce this issue again, this time in an empty Vagrant box to ensure there was no local state making the build working for me. I used Ubuntu 16.04 as base, but I don’t think that would make a big difference.
In the end all I did in the box was install git, maven, openjdk8 (for simplicity), and python 2.7. I could build successfully graylog2-server and graylog-plugin-map-widget, both version 2.2 and 2.3. I didn’t even need to run the generate-resources task to get the build done.
As I’m not able to reproduce this issue I can only give you some guesses or even long shots:
Do you do something special with npm in your bash profile? I would try running the build using a new user, just to be sure there’s nothing interfering with npm or the path
Do you by any chance have npm v5 installed on that machine? That version changes the way they install local dependencies, which is what we use to build Graylog frontend plugins, so I would try to uninstall it if it is installed
Are you using the most recent changes in the 2.3 branch? If that is the case, try pulling to the latest commit before building