Error compiling Perspective SDK example with Gradle

I cloned the IA Git Hub repository and tried to compile it per instructions…it fails. Below is the output of my Git Bash command line when I execute gradlew.bat buildModule, it times out trying to load and cache rxjs-6.5.2.tgz.

What’s strange is that when I type https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.2.tgz into a new browser page the zipped tar file downloads in a couple of seconds. Assuming it is a legitimate timeout I went to ...ignition-sdk-examples\perspective-component\web\.gradle\yarn\yarn-v1.22.4\node_modules\yarn\lib\cli.js and changed the time from 30* to 1000* var NETWORK_TIMEOUT = exports.NETWORK_TIMEOUT = 10000 * 1000; // in milliseconds only to find out after trying to build the module that the cli.js file is being over written by (I don’t know what, but a new download from a respository?) and the timeout goes back to 30*.

I’m a little flummoxed, any guidance is appriceated.
Thank you and regards,
Ted.

yarn-error.log output (snippet of)

Arguments: 
D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\nodejs\node-v10.18.1-win-x64\node.exe D:\OneDrive - Siemens Energy\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\yarn\yarn-v1.22.4\node_modules\yarn\bin\yarn.js
..
Trace: 
  Error: https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.2.tgz: ESOCKETTIMEDOUT
      at ClientRequest.<anonymous> (D:\OneDrive - Siemens Energy\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\yarn\yarn-v1.22.4\node_modules\yarn\lib\cli.js:141375:19)
      at Object.onceWrapper (events.js:286:20)
      at ClientRequest.emit (events.js:198:13)
      at TLSSocket.emitRequestTimeout (_http_client.js:662:40)
      at Object.onceWrapper (events.js:286:20)
      at TLSSocket.emit (events.js:198:13)
      at TLSSocket.Socket._onTimeout (net.js:443:8)
      at ontimeout (timers.js:436:11)
      at tryOnTimeout (timers.js:300:5)
      at listOnTimeout (timers.js:263:5)

command line output

D:\code\GitRepo\ignition-sdk-examples\perspective-component>gradlew.bat buildModule

> Task :collectToModlDeps
Copying toModl dependencies to perspective-component/build/libs

> Task :common:collectToModlDeps
Copying toModl dependencies to common/build/libs

> Task :designer:collectToModlDeps
Copying toModl dependencies to designer/build/libs

> Task :web:yarnSetup
D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\yarn\yarn-v1.22.4\yarn -> D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\yarn\yarn-v1.22.4\node_modules\yarn\bin\yarn.js
D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\yarn\yarn-v1.22.4\yarnpkg -> D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\yarn\yarn-v1.22.4\node_modules\yarn\bin\yarn.j
+ yarn@1.22.4
updated 1 package in 3.09s

> Task :web:yarn
yarn install v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.2.tgz: ESOCKETTIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "D:\\code\\GitRepo\\ignition-sdk-examples\\perspective-component\\web\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

> Task :web:yarn FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':web:yarn'.
> Process 'command 'D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\yarn\yarn-v1.22.4\yarn.cmd'' 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 5m 18s
15 actionable tasks: 5 executed, 10 up-to-date

What java version are you running?

D:\>java -version
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (Zulu 8.52.0.24-SA-win64) (build 1.8.0_282-b08)
OpenJDK 64-Bit Server VM (Zulu 8.52.0.24-SA-win64) (build 25.282-b08, mixed mode)

I also tried to execute javac -version but it said it didn’t recognize the command. I’m not sure I understand this…it doesn’t look the same as I remember it when I set it up after installing Ignition. In my environment variables JAVA_HOME is set to C:\Program Files\Java\jdk-11.0.11 and Path is set to C:\Program Files\Zulu\zulu-8-jre\bin\. I added C:\Program Files\Java\jdk-11.0.11\bin to my Path variable and moved it up, above the Zulu bin path. Last week corporate IT pushed a software update, I’m sure they changed my environment variables…again. Now I get this from my command prompt (after a reboot):

C:\>java -version
java version "11.0.11" 2021-04-20 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.11+9-LTS-194)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.11+9-LTS-194, mixed mode)

C:\>javac -version
javac 11.0.11

I tried the build again using gradlew.bat buildModule, pretty much got the same result:

D:\code\GitRepo\ignition-sdk-examples\perspective-component>gradlew.bat buildModule

> Task :collectToModlDeps
Copying toModl dependencies to perspective-component/build/libs

> Task :common:collectToModlDeps
Copying toModl dependencies to common/build/libs

> Task :designer:collectToModlDeps
Copying toModl dependencies to designer/build/libs

> Task :web:yarn
yarn install v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info If you think this is a bug, please open a bug report with the information provided in "D:\\code\\GitRepo\\ignition-sdk-examples\\perspective-component\\web\\yarn-error.log".
error An unexpected error occurred: "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.2.tgz: ESOCKETTIMEDOUT".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

> Task :web:yarn FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':web:yarn'.
> Process 'command 'D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\yarn\yarn-v1.22.4\yarn.cmd'' 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 5m 43s
15 actionable tasks: 4 executed, 11 up-to-date

I tried executing gradlew.bat buildModule --stacktrace but it just returned the command prompt. Rebooted, tried again, same thing. I definitely don’t get that. I will keep trying.

image
WTH???

Fixed the gradle batch file issue (copied the source from git hub). Ran again with --stacktrace option, heere are some snippets:

> Task :web:yarn
yarn install v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info If you think this is a bug, please open a bug report with the information provided in "D:\\code\\GitRepo\\ignition-sdk-examples\\perspective-component\\web\\yarn-error.log".
error An unexpected error occurred: "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.2.tgz: ESOCKETTIMEDOUT".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

> Task :web:yarn FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':web:yarn'.
> Process 'command 'D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\yarn\yarn-v1.22.4\yarn.cmd'' finished with non-zero exit value 1
...
...
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':web:yarn'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:166)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:163)
        at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:156)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
        at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
        at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
        at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
        at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: org.gradle.process.internal.ExecException: Process 'command 'D:\OneDrive - Siemens Energy\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\yarn\yarn-v1.22.4\yarn.cmd'' finished with non-zero exit value 1
        at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:409)

Ugh…it gets deeper all the time. Ran the build again this time using --scan for more insight. Some of the results are:

|Copying toModl dependencies to designer/build/libs||
|---|---|
|:web:npmSetup FAILED||
|npm ERR! path D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\npm\npm-v6.4.1\npx.cmd||
|npm ERR! code EEXIST||
|npm ERR! Refusing to delete D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\npm\npm-v6.4.1\npx.cmd: is outside D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\npm\npm-v6.4.1\node_modules\npm and not a link||
|npm ERR! File exists: D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\npm\npm-v6.4.1\npx.cmd||
|npm ERR! Move it away, and try again.||
|npm ERR! A complete log of this run can be found in:||
|npm ERR!     C:\Users\me\AppData\Roaming\npm-cache\_logs\2021-08-02T13_56_59_489Z-debug.log||
|FAILURE: Build failed with an exception.||
|* What went wrong:||
|Execution failed for task ':web:npmSetup'.||
|> Process 'command 'D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\npm\npm-v6.4.1\npm.cmd'' finished with non-zero exit value 1||

Are you using wifi or have a poor internet connection?

try adding this in .yarnrc file in your project root:

network-timeout 600000

maybe disable firewall

Yes, the connection is poor, home WiFi via DSL connection over a 30+ year old classic 4 telephone cable…and going through the corporate network on some kind of VPN. I will try what you suggest, thank you Victor. I’ll also disable the corp VPN and go direct. Weird though, I can go directly to the registry in a new browser instance and the tgz downloads in a second or two.

Ugh, now it fails on this…before it gets calls :web:yarn

> Task :web:npmSetup
npm ERR! path D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\npm\npm-v6.4.1\npm.cmd
npm ERR! code EEXIST
npm ERR! Refusing to delete D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\npm\npm-v6.4.1\npm.cmd: is outside D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\npm\npm-v6.4.1\node_modules\npm and not a link
npm ERR! File exists: D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\npm\npm-v6.4.1\npm.cmd
npm ERR! Move it away, and try again

.

IT FINALLY WORKED!!!
It has failed multiple times. I closed IA example repository again, but this time to a folder outside of my local git repository and after 3 tries, with your timeout suggestion, and off the corporate VPN it finally worked. Maybe one day they'll install fiber in my neighborhood.

Thank you Victor!

1 Like

Oof. Now just make sure to never .gradlew clean, I guess…

It might be possible to manually put a download file in the right location next time; I’m not sure what level of caching yarn/npm do for this stuff.

Follow up and FYI…
Just to test, I re-established my corporate VPN for all internet access and tried the build again from the project folder inside my git repo. It failed multiple times. Sometimes it said it couldn’t delete the .cmd files (different one each time) and sometimes it timed out trying to access the yarnpkg.com registry. The .cmd files are

D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\npm\npm-v6.4.1\npn.cmd

and

D:\code\GitRepo\ignition-sdk-examples\perspective-component\web\.gradle\npm\npm-v6.4.1\npx.cmd

I changed the network timeout from network-timeout 600000 to network-timeout 2400000

It worked, but it took a long time

> Task :buildModule
Unsigned module has been created at D:\OneDrive - Siemens Energy\GitRepo\ignition-sdk-examples\perspective-component\build/
BUILD SUCCESSFUL in 10m 17s

Maybe I can now, after increasing the timeout, but I hesitate :slight_smile:

more than 10 minutes? 600000 was 10 minutes it really failed for just 17 s xd
But yeah i suggest not to clean unless you are sure its needed or going on a break while its bussy.
Increasing network timeout is just a bandaid, and no solution to poor internet/chance on package loss.
Id also suggest working from ethernetcable instead of wifi.
If that is no option, maybe try a powerline adaptor ^^

It’s good to have options (powerline adaptor), thank you Victor.