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

Pendant timeout class mismatch #2606

Merged
merged 2 commits into from
Sep 18, 2024
Merged

Conversation

Erhannis
Copy link
Contributor

mvn install gave an error for ugs-pendant.

[INFO] --- frontend-maven-plugin:1.12.0:npm (build prod) @ ugs-pendant ---
[INFO] Running 'npm run build' in /home/erhannis/clones/Universal-G-Code-Sender/ugs-pendant/src/main/webapp
[INFO] 
[INFO] > webapp2@0.0.0 build
[INFO] > tsc && vite build
[INFO] 
[INFO] src/store/socketMiddleware.ts(25,3): error TS2322: Type 'Timeout' is not assignable to type 'number'.

I don't know why nobody else has had this problem, but replacing type number with NodeJS.Timeout made the error go away.

@Erhannis Erhannis changed the title There was a type error, and now there isn't Pendant timeout class mismatch Sep 11, 2024
@breiler
Copy link
Collaborator

breiler commented Sep 16, 2024

I got the same build fail on my machine with your changes as this github build.

The application is not deployed in an NodeJS environment so whenever I see those types in frontend code I get red flags.

We are using the setTimeout from the HTML DOM API which should return a number: https://developer.mozilla.org/en-US/docs/Web/API/setTimeout

Can you post your complete build log for the ugs-pendant module only. Here is my for comparison:

joacim@kitty:~/Development/Universal-G-Code-Sender/ugs-pendant$ mvn install
[INFO] Scanning for projects...
[INFO] 
[INFO] ----------< com.willwinder.universalgcodesender:ugs-pendant >-----------
[INFO] Building ugs-pendant 2.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from jogamp-remote: https://www.jogamp.org/deployment/maven/com/willwinder/universalgcodesender/ugs-core/2.0-SNAPSHOT/maven-metadata.xml
Downloading from jogamp-remote: https://www.jogamp.org/deployment/maven/com/willwinder/universalgcodesender/ugs-parent/2.0-SNAPSHOT/maven-metadata.xml
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.7:prepare-agent (default) @ ugs-pendant ---
[INFO] argLine set to -javaagent:/home/joacim/.m2/repository/org/jacoco/org.jacoco.agent/0.8.7/org.jacoco.agent-0.8.7-runtime.jar=destfile=/home/joacim/Development/Universal-G-Code-Sender/ugs-pendant/target/jacoco.exec
[INFO] 
[INFO] --- frontend-maven-plugin:1.12.0:install-node-and-npm (install node and npm) @ ugs-pendant ---
[INFO] Node v20.12.2 is already installed.
[INFO] NPM 10.5.0 is already installed.
[INFO] 
[INFO] --- frontend-maven-plugin:1.12.0:npm (npm install) @ ugs-pendant ---
[INFO] Running 'npm install' in /home/joacim/Development/Universal-G-Code-Sender/ugs-pendant/src/main/webapp
[INFO] 
[INFO] up to date, audited 270 packages in 648ms
[INFO] 
[INFO] 45 packages are looking for funding
[INFO]   run `npm fund` for details
[INFO] 
[INFO] 1 moderate severity vulnerability
[INFO] 
[INFO] To address all issues, run:
[INFO]   npm audit fix
[INFO] 
[INFO] Run `npm audit` for details.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ugs-pendant ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- flatten-maven-plugin:1.2.2:flatten (flatten) @ ugs-pendant ---
[INFO] Generating flattened POM of project com.willwinder.universalgcodesender:ugs-pendant:jar:2.0-SNAPSHOT...
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:compile (compile) @ ugs-pendant ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ugs-pendant ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/joacim/Development/Universal-G-Code-Sender/ugs-pendant/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (testCompile) @ ugs-pendant ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ ugs-pendant ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.willwinder.universalgcodesender.pendantui.PendantUITest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.533 s - in com.willwinder.universalgcodesender.pendantui.PendantUITest
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.7:report (report) @ ugs-pendant ---
[INFO] Loading execution data file /home/joacim/Development/Universal-G-Code-Sender/ugs-pendant/target/jacoco.exec
[INFO] Analyzed bundle 'ugs-pendant' with 24 classes
[INFO] 
[INFO] --- frontend-maven-plugin:1.12.0:npm (build prod) @ ugs-pendant ---
[INFO] Running 'npm run build' in /home/joacim/Development/Universal-G-Code-Sender/ugs-pendant/src/main/webapp
[INFO] 
[INFO] > webapp2@0.0.0 build
[INFO] > tsc && vite build
[INFO] 
[INFO] src/store/socketMiddleware.ts(16,23): error TS2503: Cannot find namespace 'NodeJS'.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.749 s
[INFO] Finished at: 2024-09-16T07:16:54+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.12.0:npm (build prod) on project ugs-pendant: Failed to run task: 'npm run build' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 2 (Exit value: 2) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
joacim@kitty:~/Development/Universal-G-Code-Sender/ugs-pendant$

@Erhannis
Copy link
Contributor Author

Erhannis commented Sep 17, 2024

Sure; here's the log (for the master branch - or did you want the build log for my fix branch?) :

erhannis@mnode7:~/mods/Universal-G-Code-Sender/ugs-pendant$ mvn install
[INFO] Scanning for projects...
[INFO] 
[INFO] ----------< com.willwinder.universalgcodesender:ugs-pendant >-----------
[INFO] Building ugs-pendant 2.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.7:prepare-agent (default) @ ugs-pendant ---
[INFO] argLine set to -javaagent:/home/erhannis/.m2/repository/org/jacoco/org.jacoco.agent/0.8.7/org.jacoco.agent-0.8.7-runtime.jar=destfile=/home/erhannis/mods/Universal-G-Code-Sender/ugs-pendant/target/jacoco.exec
[INFO] 
[INFO] --- frontend-maven-plugin:1.12.0:install-node-and-npm (install node and npm) @ ugs-pendant ---
[INFO] Node v20.12.2 is already installed.
[INFO] NPM 10.5.0 is already installed.
[INFO] 
[INFO] --- frontend-maven-plugin:1.12.0:npm (npm install) @ ugs-pendant ---
[INFO] Running 'npm install' in /home/erhannis/mods/Universal-G-Code-Sender/ugs-pendant/src/main/webapp
[INFO] 
[INFO] up to date, audited 270 packages in 1s
[INFO] 
[INFO] 45 packages are looking for funding
[INFO]   run `npm fund` for details
[INFO] 
[INFO] 1 moderate severity vulnerability
[INFO] 
[INFO] To address all issues, run:
[INFO]   npm audit fix
[INFO] 
[INFO] Run `npm audit` for details.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ugs-pendant ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/erhannis/mods/Universal-G-Code-Sender/ugs-pendant/src/main/resources
[INFO] 
[INFO] --- flatten-maven-plugin:1.2.2:flatten (flatten) @ ugs-pendant ---
[INFO] Generating flattened POM of project com.willwinder.universalgcodesender:ugs-pendant:jar:2.0-SNAPSHOT...
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:compile (compile) @ ugs-pendant ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ugs-pendant ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/erhannis/mods/Universal-G-Code-Sender/ugs-pendant/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (testCompile) @ ugs-pendant ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ ugs-pendant ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.willwinder.universalgcodesender.pendantui.PendantUITest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.866 s - in com.willwinder.universalgcodesender.pendantui.PendantUITest
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.7:report (report) @ ugs-pendant ---
[INFO] Loading execution data file /home/erhannis/mods/Universal-G-Code-Sender/ugs-pendant/target/jacoco.exec
[INFO] Analyzed bundle 'ugs-pendant' with 24 classes
[INFO] 
[INFO] --- frontend-maven-plugin:1.12.0:npm (build prod) @ ugs-pendant ---
[INFO] Running 'npm run build' in /home/erhannis/mods/Universal-G-Code-Sender/ugs-pendant/src/main/webapp
[INFO] 
[INFO] > webapp2@0.0.0 build
[INFO] > tsc && vite build
[INFO] 
[INFO] src/store/socketMiddleware.ts(25,3): error TS2322: Type 'Timeout' is not assignable to type 'number'.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  14.257 s
[INFO] Finished at: 2024-09-16T20:37:16-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.12.0:npm (build prod) on project ugs-pendant: Failed to run task: 'npm run build' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 2 (Exit value: 2) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

@breiler
Copy link
Collaborator

breiler commented Sep 17, 2024

Since I can't reproduce this build error on any of my machines it will be hard for me to debug or fix.

You could try using the window. to force it to use the DOM implementation of setInterval

const timer = window.setInterval(() => {

@Erhannis
Copy link
Contributor Author

Ah, that also works for me. Does it compile for you, now?

@breiler breiler merged commit 370371a into winder:master Sep 18, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants