lgrignon/jsweet-maven-plugin

tsc command not found

Closed this issue · 10 comments

Hi I try to use jsweet-maven-plugin version 3.0.0-RC1 to create javascript Classes from my backend API classes. I download node and npm using the frontend-maven-plugin which works fine so far. But when i try to use the transpiler I get the error message that the tsc.cmd is not found. So i guess the tsc is not installed correctly. What can cause this error?

My pom looks like:

<build>
	<plugins>
		<plugin>
			<groupId>com.github.eirslett</groupId>
			<artifactId>frontend-maven-plugin</artifactId>
			<!-- Use the latest released version: https://repo1.maven.org/maven2/com/github/eirslett/frontend-maven-plugin/ -->
			<version>1.9.1</version>
			<executions>
				<execution>
					<!-- optional: you don't really need execution ids, but it looks nice 
						in your build log. -->
					<id>install node and npm</id>
					<goals>
						<goal>install-node-and-npm</goal>
					</goals>
					<!-- optional: default phase is "generate-resources" -->
					<phase>generate-sources</phase>
				</execution>
			</executions>
			<configuration>
				<nodeVersion>v4.6.0</nodeVersion>

				<!-- optional: with node version greater than 4.0.0 will use npm provided 
					by node distribution -->
				<npmVersion>2.15.9</npmVersion>
				
			</configuration>
		</plugin>
		<plugin>
			<groupId>org.jsweet</groupId>
			<artifactId>jsweet-maven-plugin</artifactId>
			<version>3.0.0-RC1</version>
			<configuration>
				<outFile>client/out.js</outFile>
				<targetVersion>ES6</targetVersion>
				<includes>
					<include>**/*.java</include>
				</includes>
				<excludes>
					<exclude>**/server/**</exclude>
				</excludes>
				<extraSystemPath>${project.basedir}/node/</extraSystemPath>
			</configuration>
			<executions>
				<execution>
					<id>generate-js</id>
					<phase>generate-sources</phase>
					<goals>
						<goal>jsweet</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>

I get the error message:

Cannot run program "<user_home>.jsweet-node_modules\tsc.cmd" (in directory "D:\tools\eclipse-workspace\jsweet-test\target\ts"): CreateProcess error=2, Das System kann die angegebene Datei nicht finden
If I look into the directory <user_home>.jsweet-node_modules\ i can't see the tsc.cmd.
Is there any way to configure the path to tsc.cmd?

Hello.
I can't imagine it doesn't work with 2 drives :) but did you try putting all in C: ?

Hallo @lgrignon, I will give it a try, but i don't think the result changes. I will come back to you with the test results as

Oh, did you mean that the tsc.cmd can be found elsewhere in your:
<user_home>.jsweet-node_modules\
?

Could you please tell me where it's located?

Yes that is what i mean. It is not installed, if i install it manually using node it is installed in my ${project.basedir}/node_modules/.bin folder

JSweet should install it automatically. Could you please try deleting your <user_home>.jsweet-node_modules\ and check if there is some error message in automatic TS installation when you launch your mvn jsweet

I have tried it again and now it was installed, but the tsc.cmd is located in the folder <user_home>\.jsweet-node_modules\node_modules\.bin\. Not directly in .jsweet-node_modules

So i tried once more with newer npm and node version

<nodeVersion>v12.16.1</nodeVersion>
<npmVersion>6.14.4</npmVersion>

and this looks like it works with this setup

JSweet tries different locations to find tsc.cmd.
Does it find at your location?

If it works please close issue

It doesn't find it in the .bin folder. But looks like the installation has changed in the last version.

Thanks for your support

Oh, perfect. Enjoy using JSweet :)