Node.js build dependency

LabKey Support Forum (Inactive)
Node.js build dependency Nick Kerr  2017-06-27 12:24
Status: Closed
 
Starting in 17.2 (specifically r51632) our build has taken a dependency on Node.js and the node package manager (npm). We recommend installing/upgrading to the latest LTS version (6.x as of this writing) and ensuring you have both node/npm available on your path. Operating system specific installations are available on their website.

We've taken this dependency in order to help us build a more rich look and feel, improve theme tooling, and in general give us access to the tools available via npm.

Note to module developers: If you already have a package.json declared at the root of your module our build currently requires certain "scripts" targets be available.

  • build
  • build-prod
  • clean
  • setup
Please respond if you have any questions or problems.

Nick

 
 
slangley responded:  2017-06-28 13:05
So, after downloading Node.js and putting it in my path like so:

export PATH=/local_static/node-v6.11.0-linux-x64/bin:$PATH

and running gradle:

./gradlew build --stacktrace

I get this error:

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':server:modules:core:npm_prune'.
...
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'npm''
        at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:198)
        at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:329)
        at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:86)
        ... 2 more
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'npm'
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
        at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
        at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68)
        ... 2 more
Caused by: java.io.IOException: Cannot run program "npm" (in directory "/local_static/IdeaProjects/labkey_trunk/server/modules/core"): error=2, No such file or directory
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
        ... 4 more
Caused by: java.io.IOException: error=2, No such file or directory
        ... 5 more

While if I do:
 npm version

I get:

{ npm: '3.10.10',
  ares: '1.10.1-DEV',
  http_parser: '2.7.0',
  icu: '58.2',
  modules: '48',
  node: '6.11.0',
  openssl: '1.0.2k',
  uv: '1.11.0',
  v8: '5.1.281.102',
  zlib: '1.2.11' }


Any suggestions?

Thanks.

Scott Langley
 
Jon (LabKey DevOps) responded:  2017-06-29 12:21
Hi Scott,

Can you re-run your build again, but use the debug flag and send us the full output?

./gradlew build --debug

I'm curious to see what is going on there on your local box.

Regards,

Jon
 
slangley responded:  2017-06-29 14:09
Hope this helps:

13:56:45.248 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :server:modules:core:npm_prune (Thread[Daemon worker Thread 2,5,main]) started.
13:56:45.248 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] :server:modules:core:npm_prune
13:56:45.248 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Starting to execute task ':server:modules:core:npm_prune'
13:56:45.248 [INFO] [org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter] Putting task artifact state for task ':server:modules:core:npm_prune' into context took 0.0 secs.
13:56:45.248 [DEBUG] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Determining if task ':server:modules:core:npm_prune' is up-to-date
13:56:45.248 [INFO] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Executing task ':server:modules:core:npm_prune' (up-to-date check took 0.0 secs) due to:
  Task has not declared any outputs.
13:56:45.248 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ':server:modules:core:npm_prune'.
13:56:45.253 [INFO] [org.gradle.process.internal.DefaultExecHandle] Starting process 'command 'npm''. Working directory: /local_static/IdeaProjects/labkey_trunk/server/modules/core Command: npm prune
13:56:45.253 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Environment for process 'command 'npm'': {PATH=/local_static/node-v6.11.0-linux-x64/bin:/local_static/apache-maven-3.3.9/bin:/scharp/xapps/fw/share/jdk1.8.0_102/bin:/scharp/xapps/fw/share/play-1.4.3:/scharp/xapps/fw/bin:/home/slangley/.local/bin:/usr/local/apps/texlive/2009/bin/x86_64-linux:/usr/local/apps/bin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/usr/bin/X11:/sbin:/studies/datafax/bin:/trials/perl:/usr/local/bin:/usr/local/admin/bin:/scharp/xapps/tools/bin, XMODIFIERS=@im=local, GDMSESSION=gnome, WINDOWMANAGER=/usr/bin/gnome, BASH_FUNC_mc()=() { . /usr/share/mc/bin/mc-wrapper.sh
}, INPUTRC=/home/slangley/.inputrc, DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-qXH6BtDisd,guid=01f9776d6f85a989f951f69359444620, JRE_HOME=/scharp/xapps/fw/share/jdk1.8.0_102/jre, MACHTYPE=x86_64-suse-linux, LPDEST=itbw, JRE_ROOT=/scharp/xapps/fw/share/jdk1.8.0_102/jre, SSH_AGENT_PID=2912, QT_SYSTEM_DIR=/usr/share/desktop-data, LD_LIBRARY_PATH=/usr/local/apps/lib:/usr/local/lib:/lib:/usr/lib:/lib:/systems/local/lib:/usr/local/apps/lib:/usr/local/lib:/lib:/usr/lib:/lib:/systems/local/lib:, COLORTERM=gnome-terminal, CSHEDIT=emacs, XAUTHLOCALHOSTNAME=localhost, SESSION_MANAGER=local/hyena:@/tmp/.ICE-unix/2787,unix/hyena:/tmp/.ICE-unix/2787, USERNAME=slangley, LS_OPTIONS=-N --color=tty -T 0, ALSA_CONFIG_PATH=/etc/alsa-pulse.conf, ORBIT_SOCKETDIR=/tmp/orbit-slangley, PWD=/local_static/IdeaProjects/labkey_trunk, WINDOWID=65011715, LESSOPEN=lessopen.sh %s, PAGER=/usr/bin/less, GDM_KEYBOARD_LAYOUT=us, HOSTTYPE=x86_64, GNOME_DESKTOP_SESSION_ID=this-is-deprecated, EXTJS_HOME=/local_static/IdeaProjects/labkey_trunk/server/api/webapp/ext-4.2.1, LABKEY_ROOT=/local_static/IdeaProjects/labkey_trunk, XDG_SESSION_COOKIE=a0db89c2509a6f59e615006d4fe4e438-1497646622.655318-1326460311, SHLVL=1, INFODIR=/usr/local/info:/usr/share/info:/usr/info, ICEAUTHORITY=/home/slangley/.ICEauthority, HISTSIZE=1000, JAVA_ROOT=/scharp/xapps/fw/share/jdk1.8.0_102/, JAVA_HOME=/scharp/xapps/fw/share/jdk1.8.0_102, SDL_AUDIODRIVER=pulse, TERM=xterm, XDG_CONFIG_DIRS=/etc/xdg, G_BROKEN_FILENAMES=1, ANT_HOME=/local_static/apache-ant-1.8.4, XNLSPATH=/usr/share/X11/nls, GTK_RC_FILES=/etc/gtk/gtkrc:/home/slangley/.gtkrc-1.2-gnome2, JENSOR_HOME=/local_static/Jensor, PROFILEREAD=true, DESKTOP_SESSION=gnome, JDK6__HOME=/local_static/java6, MORE=-sl, NLSPATH=/usr/dt/lib/nls/msg/%L/%N.cat, VIRTUALENV_USE_DISTRIBUTE=true, XAUTHORITY=/var/run/gdm/auth-for-slangley-ry7rUX/database, XDG_DATA_DIRS=/usr/local/share:/usr/share:/etc/opt/kde3/share:/opt/kde3/share, HOST=hyena, CPU=x86_64, GTK_IM_MODULE=cedilla, XSESSION_IS_UP=yes, G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-15,CP1252, MINICOM=-c on, MAIL=/var/spool/mail/slangley, NEXUS_HOME=/local_static/nexus, SWT_GTK3=0, OSTYPE=linux, LOGNAME=slangley, TOMCAT_HOME=/local_static/tomcat7, JDK_HOME=/scharp/xapps/fw/share/jdk1.8.0_102, LD_LIBRARY_PATH_64=/usr/local/apps/lib:/lib64:/usr/lib64:/lib64:/usr/local/apps/lib:/lib64:/usr/lib64:/lib64:, INFOPATH=/usr/local/info:/usr/share/info:/usr/info, XCURSOR_THEME=, PLAY_PATH=/scharp/xapps/fw/share/play-1.4.3, SHELL=/bin/bash, DATAFAX_DIR=/studies/datafax, OLDPWD=/local_static/IdeaProjects/labkey_trunk, VISUAL=vi, TMPDIR=/tmp, SSH_ASKPASS=/usr/lib64/ssh/x11-ssh-askpass, JRE_BINDIR=/scharp/xapps/fw/share/jdk1.8.0_102/jre/bin, LESS=-M -I, LS_COLORS=no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:, GNOME_KEYRING_SOCKET=/tmp/keyring-QknGBT/socket, OPENSSL_NO_DEFAULT_ZLIB=yes, LESSCLOSE=lessclose.sh %s %s, MANPATH=/local_static/man:/local_static/share/man:/local_static/man:/local_static/share/man:/home/slangley/man:/usr/local/man:/usr/share/man, QT_IM_MODULE=xim, JAVA_BINDIR=/scharp/xapps/fw/share/jdk1.8.0_102/bin, ENV=/etc/bash.bashrc, XFILESEARCHPATH=/usr/dt/app-defaults/%L/Dt, LANG=en_US.UTF-8, DISPLAY=:0.0, IDEA_JDK=/scharp/xapps/fw/share/jdk1.8.0_102, LESSKEY=/etc/lesskey.bin, TMOUT=0, PYTHONSTARTUP=/etc/pythonstart, NNTPSERVER=news, QT_IM_SWITCHER=imsw-multi, JAVA6_HOME=/local_static/java6, FROM_HEADER=, GDM_LANG=en_US.UTF-8, FINDBUGS_HOME=/local_static/findbugs-2.0.1-rc1, CATALINA_HOME=/local_static/tomcat7, GPG_AGENT_INFO=/tmp/seahorse-IelX6a/S.gpg-agent:2911:1, USER=slangley, SSH_AUTH_SOCK=/tmp/keyring-QknGBT/socket.ssh, EDITOR=vi, PRINTER=itbw, HOSTNAME=hyena, JRE6_ROOT=/local_static/java6/jre, XKEYSYMDB=/usr/share/X11/XKeysymDB, LESS_ADVANCED_PREPROCESSOR=no, JRE6_HOME=/local_static/java6/jre, HOME=/home/slangley, GNOME_KEYRING_PID=2778}
13:56:45.253 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTING
13:56:45.253 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Waiting until process started: command 'npm'.
13:56:45.831 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: FAILED
13:56:45.831 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process 'command 'npm'' finished with exit value -1 (state: FAILED)
13:56:45.831 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter] Removed task artifact state for {} from context.
13:56:45.831 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':server:modules:core:npm_prune'
13:56:45.832 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] :server:modules:core:npm_prune FAILED
13:56:45.832 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :server:modules:core:npm_prune (Thread[Daemon worker Thread 2,5,main]) completed. Took 0.584 secs.
13:56:45.832 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationWorkerRegistry] Worker root.295 completed (0 in use)
13:56:45.832 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[Daemon worker Thread 2,5,main]] finished, busy: 1.19 secs, idle: 0.029 secs
13:56:45.835 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
13:56:45.835 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.

Thanks.

Scott
 
Jon (LabKey DevOps) responded:  2017-07-03 23:41
Thanks Scott.

The error itself looks really odd since it mentions that the path "/local_static/IdeaProjects/labkey_trunk/server/modules/core" doesn't exist, but I'm assuming it does on your system, yes?

Does the same problem come back up if you do a "gradlew deployApp" or "gradlew cleanbuild deployApp"?

Regards,

Jon
 
Susan Hert responded:  2017-07-04 08:17
Hi, Scott,

 It looks like the second error message is different than the first. If you run the command 'npm prune' in the server/modules/core directory (just by itself, and not using Gradle) does it succeed?

Susan
 
slangley responded:  2017-07-05 10:45
Yes to the above:

1. This path exists: '/local_static/IdeaProjects/labkey_trunk/server/modules/core'

2. Running 'npm prune' in server/modules/core directory succeeds.

3. Running './gradlew cleanbuild deployApp' completed successfully.

Thanks!
 
Jon (LabKey DevOps) responded:  2017-07-05 11:03
Hi Scott,

Thanks for confirming.

Unless I'm mistaken, I think you shouldn't be running things as "gradlew build", but rather as "gradlew deployApp".

If you were running "gradlew build" like it was "ant build" when we were using Ant previously, that would need to change to "gradlew deployApp" instead.

Our docs here show the old ant syntax and the new gradle ones that should be used instead. Knowing that you were able to do "gradlew cleanbuild deployApp" successfully, that is the equivalent of "ant rebuild", which should get you up and running now.

https://www.labkey.org/Documentation/wiki-page.view?name=gradlebuild

Does that make sense?

Regards,

Jon
 
slangley responded:  2017-07-05 13:08
Yes, that makes sense.

I had been running 'gradlew deployApp' up until now.

I guess the state of the build became such that a 'cleanbuild' became necessary.

I think I'm good now.

Scott
 
Andy Straw responded:  2017-08-03 08:34
Would you please add information about this dependency on Node.js to this wiki page:
https://www.labkey.org/Documentation/wiki-page.view?name=devMachine

Thanks.
 
Jon (LabKey DevOps) responded:  2017-08-03 13:50
Hi Andy,

I've requested for our docs team to update the dev doc with the additional details on node.js

Regards,

Jon
 
Will Holtz responded:  2018-01-26 09:05
I recently got the same error as Scott but doing './gradlew cleanbuild deployApp' did not resolve the issue. A response to a similar issue on stackoverflow (https://stackoverflow.com/questions/33546759/gradle-occurred-starting-process-command-npm-on-mac/) indicated that './gradlew --stop' has resolved a similar issue. I'm not sure why stopping the gradle daemon allowed './gradlew cleanbuild deployApp' to successfully complete, but it worked for me so I thought I'd pass it on.

-Will