SweetHome3DJS won't compile

This topic has been viewed 4607 times and has 5 replies
Thread status: Active
Questions about Sweet Home 3D installation [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
bernard_s
Posts: 5
Joined: Wed Feb 09, 2022 5:33 pm
Country: UK

SweetHome3DJS won't compile

Post by bernard_s »

Hi

Brilliant system and was looking forward to running the browser version :) However:

Running ant (Windows 10) on SweetHome3DJS fails to build. It is related to tsc which it says it cannot find.

Cannot run program "C:\Users\b_s\.jsweet.v3-node_modules\tsc.cmd"
The system cannot find the file specified

The folder exists
C:\Users\b_s\.jsweet.v3-node_modules\

...but tsc.cmd is instead under C:\Users\b_s\.jsweet.v3-node_modules\node_modules\.bin\

Any ideas hwo I fix it?

thanks.
Bernard
>>>>>>>>>>>>>>>
Portion of the ant log:
...
[java] 2022-02-20 20:11:28.028 INFO JSweetTranspiler:1227 - created tools\JSweet\build\ts\bundle.d.ts
[java] 2022-02-20 20:11:28.028 INFO JSweetTranspiler:865 - ts2js on org.jsweet.transpiler.TypeScript2JavaScriptWithTscTranspiler@b7f2c13 sourceFiles=137
[java] 2022-02-20 20:11:28.028 INFO TypeScript2JavaScriptWithTscTranspiler:84 - launching tsc...
[java] 2022-02-20 20:11:28.028 ERROR ProcessUtil:365 - Cannot run program "C:\Users\b_s\.jsweet.v3-node_modules\tsc.cmd" (in directory "tools\JSweet\build\ts"): CreateProcess error=2, The system cannot find the file specified
[java] java.io.IOException: Cannot run program "C:\Users\b_s\.jsweet.v3-node_modules\tsc.cmd" (in directory "tools\JSweet\build\ts"): CreateProcess error=2, The system cannot find the file specified
[java] at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
[java] at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
[java] at org.jsweet.transpiler.util.ProcessUtil.runCommand(ProcessUtil.java:317)
[java] at org.jsweet.transpiler.TypeScript2JavaScriptWithTscTranspiler.doTranspile(TypeScript2JavaScriptWithTscTranspiler.java:92)
[java] at org.jsweet.transpiler.TypeScript2JavaScriptTranspiler.ts2js(TypeScript2JavaScriptTranspiler.java:37)
[java] at org.jsweet.transpiler.JSweetTranspiler.ts2js(JSweetTranspiler.java:866)
[java] at org.jsweet.transpiler.JSweetTranspiler.transpile(JSweetTranspiler.java:841)
[java] at org.jsweet.JSweetCommandLineLauncher$JSweetTranspilationTask.run(JSweetCommandLineLauncher.java:897)
[java] at org.jsweet.JSweetCommandLineLauncher.transpileWithArgs(JSweetCommandLineLauncher.java:272)
[java] at org.jsweet.JSweetCommandLineLauncher.main(JSweetCommandLineLauncher.java:240)
[java] Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
[java] at java.base/java.lang.ProcessImpl.create(Native Method)
[java] at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:487)
[java] at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:154)
[java] at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
[java] ... 9 more
[java] ERROR: Unknown tsc error
[java] 2022-02-20 20:11:28.028 INFO JSweetTranspiler:849 - transpilation process finished in 23174 ms
[java] > java2ts: 19898.3957ms
[java] > ts2js: 44.0433ms
[java]
[java] INFO: transpilation failed with 1 error(s) and 0 warning(s)

BUILD FAILED
c:\sh3d\SweetHome3DJS\build.xml:81: The following error occurred while executing this line:
c:\sh3d\SweetHome3DJS\build.xml:37: Java returned: 1

Total time: 25 seconds
renaudpawlak
Posts: 3
Joined: Tue Nov 08, 2016 7:53 pm
Country: France
Contact:

Re: SweetHome3DJS won't compile

Post by renaudpawlak »

Well, that's annoying... Apparently, tsc does not install where JSweet expects it to be installed.

Maybe the installation went wrong for some reason, to you might try to remove the .jsweet.v3-node_modules directory and try again.

Otherwise, as a dirty quickfix, you may try to manually copy .jsweet.v3-node_modules/node_modules/.bin/tsc.cmd to .jsweet.v3-node_modules/tsc and see what happens.
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: SweetHome3DJS won't compile

Post by Puybaret »

I tried again to build SweetHome3DJS and didn't encountered any issue.
Maybe there was some recent changes in folders organization of Node.js.
The version I use is 14.17 (returned by the command [font=courier new]node -v[/font]). What is yours?
Emmanuel Puybaret, Sweet Home 3D creator
bernard_s
Posts: 5
Joined: Wed Feb 09, 2022 5:33 pm
Country: UK

Re: SweetHome3DJS won't compile

Post by bernard_s »

Hi both,

The good news is that installing node version 14.7.6 allowed the build to complete successfully :) I was on node v16.14.0. I have now deployed the war and can see/use the editor. The bad news is that I am unable to save anything. I draw something, wait a while and get a browser console error 500 for writeHomeEdits.jsp and then "update failed" which reports sweethome3d.min.js line
87200. This line is within function IncrementalHomeRecorder.prototype.sendUndoableEdits:

request.send("home=" + encodeURIComponent(d.name) + "&editionId=" + d.editionId + "&updateId=" + f.id + "&version=" + this.application.getVersion() + "&edits=" +
encodeURIComponent(JSON.stringify(f.edits)))

In the java log (see whole chunk below), I also see:

22-Feb-2022 17:16:14.610 SEVERE [http-nio-8080-exec-5] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [jsp] in context with path [/SweetHome3DJS-6.6.4] threw exception
java.io.IOException: An exception occurred processing [/writeHomeEdits.jsp] at line [47]
44: // Get preferences stored as an application attribute
45: UserPreferences serverUserPreferences = (UserPreferences)getServletContext().getAttribute("serverUserPreferences");
46: if (serverUserPreferences == null) {
47: serverUserPreferences = new ServerUserPreferences(
48: new URL [] {new URL(serverBaseUrl, "lib/resources/DefaultFurnitureCatalog.json")}, serverBaseUrl,
49: new URL [] {new URL(serverBaseUrl, "lib/resources/DefaultTexturesCatalog.json")}, serverBaseUrl);
50: getServletContext().setAttribute("serverUserPreferences", serverUserPreferences);
...
Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
...

Any ideas?

Bernard

>>>>>

22-Feb-2022 17:16:14.610 SEVERE [http-nio-8080-exec-5] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [jsp] in context with path [/SweetHome3DJS-6.6.4] threw exception
java.io.IOException: An exception occurred processing [/writeHomeEdits.jsp] at line [47]

44: // Get preferences stored as an application attribute
45: UserPreferences serverUserPreferences = (UserPreferences)getServletContext().getAttribute("serverUserPreferences");
46: if (serverUserPreferences == null) {
47: serverUserPreferences = new ServerUserPreferences(
48: new URL [] {new URL(serverBaseUrl, "lib/resources/DefaultFurnitureCatalog.json")}, serverBaseUrl,
49: new URL [] {new URL(serverBaseUrl, "lib/resources/DefaultTexturesCatalog.json")}, serverBaseUrl);
50: getServletContext().setAttribute("serverUserPreferences", serverUserPreferences);


Stacktrace:
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:494)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:359)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:889)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1735)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.Socket.connect(Socket.java:609)
at java.base/java.net.Socket.connect(Socket.java:558)
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:182)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)
at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:341)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:362)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1253)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1187)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)
at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1015)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
at java.base/java.net.URL.openStream(URL.java:1165)
at com.eteks.sweethome3d.io.ServerUserPreferences$JSONResourceBundle.<init>(Unknown Source)
at com.eteks.sweethome3d.io.ServerUserPreferences$1.<init>(Unknown Source)
at com.eteks.sweethome3d.io.ServerUserPreferences.<init>(Unknown Source)
at org.apache.jsp.writeHomeEdits_jsp._jspService(writeHomeEdits_jsp.java:158)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466)
... 25 more
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: SweetHome3DJS won't compile

Post by Puybaret »

The good news is that installing node version 14.7.6 allowed the build to complete successfully :) I was on node v16.14.0
Good to know :)
I hope Renaud will find a way to adapt JSweet accordingly.

Under what Java server did you try to run the war file?
Can you log the value of serverBaseUrl used at line 48 in writeHomeEdits.jsp? Maybe you could just adapt its initialization at line 32 to ensure it works in your case?
Emmanuel Puybaret, Sweet Home 3D creator
bernard_s
Posts: 5
Joined: Wed Feb 09, 2022 5:33 pm
Country: UK

Re: SweetHome3DJS won't compile

Post by bernard_s »

Looking at the serverBaseUrl gave me the clue. It was a firewall issue for port 8080. All sorted now and working great. Thanks for the help!
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 3 guests