Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build in Container fails with Error: Cannot find module '../lib/utils/unsupported.js' #28

Closed
vorburger opened this issue Apr 18, 2018 · 5 comments

Comments

@vorburger
Copy link
Member

vorburger commented Apr 18, 2018

When building this project (as of dc9b703) in a container (S2I), then it fails:

Starting S2I Java Build .....
S2I source build for Gradle detected, due to presence of a *.gradle* in /tmp/src
TODO ;) set up possibly HTTP proxy server for Gradle build (not yet implemented)...
Using GRADLE_OPTS '-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:+ExitOnOutOfMemoryError'
Running './gradlew build -x test '
Downloading https://services.gradle.org/distributions/gradle-4.6-bin.zip
......................................................................
Unzipping /opt/jboss/.gradle/wrapper/dists/gradle-4.6-bin/4jp4stjndanmxuerzfseyb6wo/gradle-4.6-bin.zip to /opt/jboss/.gradle/wrapper/dists/gradle-4.6-bin/4jp4stjndanmxuerzfseyb6wo
Set executable permissions for: /opt/jboss/.gradle/wrapper/dists/gradle-4.6-bin/4jp4stjndanmxuerzfseyb6wo/gradle-4.6/bin/gradle
Starting a Gradle Daemon (subsequent builds will be faster)
Download https://plugins.gradle.org/m2/com/github/hierynomus/license/com.github.hierynomus.license.gradle.plugin/0.14.0/com.github.hierynomus.license.gradle.plugin-0.14.0.pom
Download https://plugins.gradle.org/m2/net/ltgt/errorprone/net.ltgt.errorprone.gradle.plugin/0.0.13/net.ltgt.errorprone.gradle.plugin-0.0.13.pom
Download https://plugins.gradle.org/m2/biz/aQute/bnd/biz.aQute.bnd.gradle/3.5.0/biz.aQute.bnd.gradle-3.5.0.pom
Download https://plugins.gradle.org/m2/gradle/plugin/nl/javadude/gradle/plugins/license-gradle-plugin/0.14.0/license-gradle-plugin-0.14.0.pom
Download https://plugins.gradle.org/m2/net/ltgt/gradle/gradle-errorprone-plugin/0.0.13/gradle-errorprone-plugin-0.0.13.pom
Download https://plugins.gradle.org/m2/com/mycila/license-maven-plugin/3.0/license-maven-plugin-3.0.pom
Download https://plugins.gradle.org/m2/com/mycila/xmltool/xmltool/3.3/xmltool-3.3.pom
Download https://plugins.gradle.org/m2/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.pom
Download https://plugins.gradle.org/m2/com/mycila/license-maven-plugin-parent/3.0/license-maven-plugin-parent-3.0.pom
Download https://plugins.gradle.org/m2/org/codehaus/plexus/plexus/2.0.6/plexus-2.0.6.pom
Download https://plugins.gradle.org/m2/com/mycila/mycila-pom/3/mycila-pom-3.pom
Download https://plugins.gradle.org/m2/org/springframework/spring-core/3.1.3.RELEASE/spring-core-3.1.3.RELEASE.pom
Download https://plugins.gradle.org/m2/org/apache/maven/maven-settings-builder/3.0.4/maven-settings-builder-3.0.4.pom
Download https://plugins.gradle.org/m2/org/apache/maven/maven-settings/3.0.4/maven-settings-3.0.4.pom
Download https://plugins.gradle.org/m2/com/mycila/mycila-xmltool/4.4.ga/mycila-xmltool-4.4.ga.pom
Download https://plugins.gradle.org/m2/org/springframework/spring-parent/3.1.3.RELEASE/spring-parent-3.1.3.RELEASE.pom
Download https://plugins.gradle.org/m2/org/apache/maven/maven/3.0.4/maven-3.0.4.pom
Download https://plugins.gradle.org/m2/org/apache/maven/maven-parent/21/maven-parent-21.pom
Download https://plugins.gradle.org/m2/org/apache/apache/10/apache-10.pom
Download https://plugins.gradle.org/m2/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.pom
Download https://plugins.gradle.org/m2/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.pom
Download https://plugins.gradle.org/m2/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.pom
Download https://plugins.gradle.org/m2/org/codehaus/plexus/plexus-components/1.1.18/plexus-components-1.1.18.pom
Download https://plugins.gradle.org/m2/org/codehaus/plexus/plexus-containers/1.5.5/plexus-containers-1.5.5.pom
Download https://plugins.gradle.org/m2/org/sonatype/spice/spice-parent/12/spice-parent-12.pom
Download https://plugins.gradle.org/m2/org/codehaus/plexus/plexus/2.0.7/plexus-2.0.7.pom
Download https://plugins.gradle.org/m2/org/sonatype/forge/forge-parent/4/forge-parent-4.pom
Download https://plugins.gradle.org/m2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom
Download https://plugins.gradle.org/m2/org/springframework/spring-asm/3.1.3.RELEASE/spring-asm-3.1.3.RELEASE.pom
Download https://plugins.gradle.org/m2/org/apache/commons/commons-parent/5/commons-parent-5.pom
Download https://plugins.gradle.org/m2/org/apache/apache/4/apache-4.pom
Download https://plugins.gradle.org/m2/org/apache/commons/commons-pool2/2.2/commons-pool2-2.2.pom
Download https://plugins.gradle.org/m2/org/apache/commons/commons-parent/33/commons-parent-33.pom
Download https://plugins.gradle.org/m2/org/apache/apache/13/apache-13.pom
Download https://plugins.gradle.org/m2/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.pom
Download https://plugins.gradle.org/m2/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6.pom
Download https://plugins.gradle.org/m2/gradle/plugin/nl/javadude/gradle/plugins/license-gradle-plugin/0.14.0/license-gradle-plugin-0.14.0.jar
Download https://plugins.gradle.org/m2/com/mycila/license-maven-plugin/3.0/license-maven-plugin-3.0.jar
Download https://plugins.gradle.org/m2/net/ltgt/gradle/gradle-errorprone-plugin/0.0.13/gradle-errorprone-plugin-0.0.13.jar
Download https://plugins.gradle.org/m2/org/apache/maven/maven-settings/3.0.4/maven-settings-3.0.4.jar
Download https://plugins.gradle.org/m2/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
Download https://plugins.gradle.org/m2/biz/aQute/bnd/biz.aQute.bnd.gradle/3.5.0/biz.aQute.bnd.gradle-3.5.0.jar
Download https://plugins.gradle.org/m2/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6.jar
Download https://plugins.gradle.org/m2/com/mycila/xmltool/xmltool/3.3/xmltool-3.3.jar
Download https://plugins.gradle.org/m2/org/springframework/spring-core/3.1.3.RELEASE/spring-core-3.1.3.RELEASE.jar
Download https://plugins.gradle.org/m2/com/mycila/mycila-xmltool/4.4.ga/mycila-xmltool-4.4.ga.jar
Download https://plugins.gradle.org/m2/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
Download https://plugins.gradle.org/m2/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
Download https://plugins.gradle.org/m2/org/springframework/spring-asm/3.1.3.RELEASE/spring-asm-3.1.3.RELEASE.jar
Download https://plugins.gradle.org/m2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
Download https://plugins.gradle.org/m2/org/apache/commons/commons-pool2/2.2/commons-pool2-2.2.jar
Download https://plugins.gradle.org/m2/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
Download https://plugins.gradle.org/m2/org/apache/maven/maven-settings-builder/3.0.4/maven-settings-builder-3.0.4.jar
Download https://plugins.gradle.org/m2/com/moowork/node/com.moowork.node.gradle.plugin/1.2.0/com.moowork.node.gradle.plugin-1.2.0.pom
Download https://plugins.gradle.org/m2/com/moowork/gradle/gradle-node-plugin/1.2.0/gradle-node-plugin-1.2.0.pom
Download https://plugins.gradle.org/m2/com/moowork/gradle/gradle-node-plugin/1.2.0/gradle-node-plugin-1.2.0.jar
Download https://plugins.gradle.org/m2/com/github/johnrengelman/shadow/com.github.johnrengelman.shadow.gradle.plugin/2.0.2/com.github.johnrengelman.shadow.gradle.plugin-2.0.2.pom
Download https://plugins.gradle.org/m2/com/github/jengelman/gradle/plugins/shadow/2.0.2/shadow-2.0.2.pom
Download https://plugins.gradle.org/m2/org/ow2/asm/asm-commons/6.0/asm-commons-6.0.pom
Download https://plugins.gradle.org/m2/org/ow2/asm/asm/6.0/asm-6.0.pom
Download https://plugins.gradle.org/m2/commons-io/commons-io/2.5/commons-io-2.5.pom
Download https://plugins.gradle.org/m2/org/jdom/jdom2/2.0.6/jdom2-2.0.6.pom
Download https://plugins.gradle.org/m2/org/apache/commons/commons-parent/39/commons-parent-39.pom
Download https://plugins.gradle.org/m2/org/ow2/asm/asm-parent/6.0/asm-parent-6.0.pom
Download https://plugins.gradle.org/m2/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.pom
Download https://plugins.gradle.org/m2/org/ow2/ow2/1.3/ow2-1.3.pom
Download https://plugins.gradle.org/m2/org/codehaus/plexus/plexus/4.0/plexus-4.0.pom
Download https://plugins.gradle.org/m2/org/apache/apache/16/apache-16.pom
Download https://plugins.gradle.org/m2/org/apache/ant/ant/1.9.7/ant-1.9.7.pom
Download https://plugins.gradle.org/m2/org/sonatype/forge/forge-parent/10/forge-parent-10.pom

Download https://plugins.gradle.org/m2/org/apache/ant/ant-parent/1.9.7/ant-parent-1.9.7.pom
Download https://plugins.gradle.org/m2/org/ow2/asm/asm-tree/6.0/asm-tree-6.0.pom
Download https://plugins.gradle.org/m2/org/apache/ant/ant-launcher/1.9.7/ant-launcher-1.9.7.pom
Download https://plugins.gradle.org/m2/org/ow2/asm/asm-commons/6.0/asm-commons-6.0.jar
Download https://plugins.gradle.org/m2/org/jdom/jdom2/2.0.6/jdom2-2.0.6.jar
Download https://plugins.gradle.org/m2/org/ow2/asm/asm-tree/6.0/asm-tree-6.0.jar
Download https://plugins.gradle.org/m2/com/github/jengelman/gradle/plugins/shadow/2.0.2/shadow-2.0.2.jar
Download https://plugins.gradle.org/m2/commons-io/commons-io/2.5/commons-io-2.5.jar
Download https://plugins.gradle.org/m2/org/apache/ant/ant/1.9.7/ant-1.9.7.jar
Download https://plugins.gradle.org/m2/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.jar
Download https://plugins.gradle.org/m2/org/apache/ant/ant-launcher/1.9.7/ant-launcher-1.9.7.jar
Download https://plugins.gradle.org/m2/org/ow2/asm/asm/6.0/asm-6.0.jar
:compileJava NO-SOURCE
:processResources NO-SOURCE
:classes UP-TO-DATE
:jar
:assemble
:licenseMain NO-SOURCE
:licenseTest NO-SOURCE
:license UP-TO-DATE
:check
:build
:scratch:copyIcon
:scratch:nodeSetup
Download https://nodejs.org/dist/v8.11.1/node-v8.11.1-linux-x64.tar.gz
module.js:549
    throw err;
    ^

Error: Cannot find module '../lib/utils/unsupported.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at /tmp/src/scratch/.gradle/npm/npm-v5.8.0/bin/npm:19:21
    at Object.<anonymous> (/tmp/src/scratch/.gradle/npm/npm-v5.8.0/bin/npm:92:3)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
:scratch:npmSetup FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':scratch:npmSetup'.
> Process 'command '/tmp/src/scratch/.gradle/npm/npm-v5.8.0/bin/npm'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 12s
4 actionable tasks: 4 executed
Aborting due to error code 1 for Gradle build
Build failed
ERROR: An error occurred: non-zero (13) exit code from fabric8/s2i-java

that is including https://github.com/vorburger/minecraft-storeys-maker/pull/26 (but without that it would, most probably, just fail for nothing finding NPM at all).

One should be able to locally reproduce above like this, using WIP fabric8io-images/s2i#118, from my fork:

docker build https://github.com/vorburger/s2i.git#gradle:java/images/jboss
rm Dockerfile
s2i build --copy . fabric8/s2i-java minecraft-storeys-maker

@edewit do you have any clue what the message above could be trying to tell us? Cauz I really don't... 😄 But this is not urgent or blocking, because I'll just try to progress on https://github.com/vorburger/minecraft-storeys-maker/issues/19 using an approach starting with the binary JAR, instead of full S2I from source build instead, because of this.

@edewit
Copy link
Member

edewit commented Apr 19, 2018

This is an issue with node this is what I found on stack overflow: https://stackoverflow.com/questions/44363066/error-cannot-find-module-lib-utils-unsupported-js-while-using-ionic?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
seems to me that setting maybe the node path might be a solution?

@vorburger
Copy link
Member Author

Curiously, I've not hit this when building it on Appuio; not sure how that's possible, but do hit it on Minishift:

oc new-build https://github.com/vorburger/s2i.git#gradle --context-dir=java/images/jboss

oc new-build s2i~https://github.com/vorburger/minecraft-storeys-maker.git

@vorburger
Copy link
Member Author

that setting maybe the node path might be a solution?

I'm not sure I understand to exactly what to set NODE_PATH to where, in our situation...

@vorburger
Copy link
Member Author

we tried to add this to .s2i/environment but this didn't help:

 NODE_PATH=/tmp/scratch/.gradle/npm/npm-v5.8.0/lib/node_modules/

@vorburger
Copy link
Member Author

Duh! This ONLY happens with:

s2i build --copy . 

but not with:

s2i build https://github.com/vorburger/minecraft-storeys-maker/

and this is because the local dir was "dirty" and contained already downloaded node_modules in x3 (!) directories - which somehow interfered with and caused this. When we clean up the local directory BEFORE s2i build --copy . like this:

rm -rf scratch/.gradle/ scratch/node_modules

then it magically works!

vorburger added a commit that referenced this issue May 1, 2018
fix link to issue #28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants