Plugin Build Errors

Hi there,

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.

Hi @bradleykite,

Could you please provide the steps you took to compile both graylog2-server and the plugins?

Regards,
Edmundo

Hi,

Yes - see below.

graylog2-server compiles OK

cd graylog2-server
mvn install

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Graylog Parent POM ................................ SUCCESS [9.003s]
[INFO] Graylog Project Parent POM ........................ SUCCESS [19.965s]
[INFO] AutoValue JavaBean extension ...................... SUCCESS [41.606s]
[INFO] Graylog ........................................... SUCCESS [7:57.426s]
[INFO] integration-tests ................................. SUCCESS [13.692s]
[INFO] Graylog Plugin Parent POM ......................... SUCCESS [0.003s]
[INFO] Graylog Plugin with Web support Parent POM ........ SUCCESS [0.894s]
[INFO] graylog-plugin-archetype .......................... SUCCESS [24.772s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9:47.630s
[INFO] Finished at: Fri Nov 10 15:42:53 GMT 2017
[INFO] Final Memory: 45M/497M
[INFO] ------------------------------------------------------------------------

cd ../graylog-plugin-map-widget
mvn install

[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.

Anyway, if you take a look at the readme file in graylog-plugin-map-widget:

Run mvn package to build a JAR file.

What do you want to accomplish? In that way I can tell you a bit more on which way I would solve the issue.

Which system user are you using to compile Graylog?

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.

And which system user are you using to compile Graylog?

jochen - sorry I mis-read your previous question - I’m running as a normal user (not root) - “bradley” in this case.

edmundo, I have removed the node and node_modules directory and re-run “mvn generate-resources” - the full log is available here:

https://pastebin.com/GQXzkx6d

Regards

Brad.

Hi there,

I’m still really stuck with this - I’m not overly familiar with maven and/or npm/nodejs etc so dont really know where else to go with this.

Any help will be much appreciated!

Regards

Brad.

Hi

I am still not able to make any progress when building plugins for 2.3.

If there is anything I can do or if anyone has any pointers then please let me know, I’d be more than willing to try them.

Plugins for 2.2 build just fine using the same build process so I think I must be missing a step that is required for 2.3?

Thanks in advance for any help that anyone can offer.


Brad.

Hi @bradleykite,

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:

  1. 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
  2. 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
  3. 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

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