Missing vite\package.json in node_modules during building Keycloak

Hi,

I’d like to contribute to this awesome project and solve a few open issues. I use Keycloak quite a lot and figured its time to dive deeper into how it works and give something back while doing this.

In order to do so, I try to get keycloak built properly as a first step, of course. Sadly the build runs into the following error:

[INFO] --- frontend:1.14.2:pnpm (pnpm-install) @ keycloak-admin-ui ---
[INFO] Running 'pnpm install --prefer-offline --frozen-lockfile --ignore-scripts' in D:\Workspace\Projekte\GitHub\Keycloak\keycloak\js\apps\admin-ui
[INFO] Scope: all 4 workspace projects
[INFO] ../..                                    | Progress: resolved 1, reused 0, downloaded 0, added 0
[INFO] ../..                                    | +883 ++++++++++++++++++++++++++++++++
[INFO] ../..                                    | Progress: resolved 1, reused 1, downloaded 0, added 1, done
[INFO] â??ENOENTâ?? ENOENT: no such file or directory, open 'xxx\keycloak\js\node_modules\.pnpm\vite@5.1.0_@types+node@20.11.17_lightningcss@1.23.0\node_modules\vite\package.json'
[INFO]
[INFO] pnpm: ENOENT: no such file or directory, open 'xxx\keycloak\js\node_modules\.pnpm\vite@5.1.0_@types+node@20.11.17_lightningcss@1.23.0\node_modules\vite\package.json'

edit: The funnny thing is: If I execute the command

pnpm install --prefer-offline --frozen-lockfile --ignore-scripts

directly in the js/apps/admin-ui directory, it works. So it seems to be a problem, which only occurs during the maven build.

Any ideas? :slight_smile:

If anyone else stumbles over this:
I got it solved by commenting out the line, which deletes the node_modules directory in the maven-clean-plugin of the “js/pom.xml”:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-clean-plugin</artifactId>
    <configuration>
        <followSymLinks>false</followSymLinks>
        <filesets>
            <fileset>
                <directory>${basedir}</directory>
                <includes>
                    <include>**/.wireit/**</include>
                    <!-- <include>**/node_modules/**</include> -->
                </includes>
            </fileset>
            <!-- include all non-maven projects here as well -->
            <fileset>
                <directory>apps/keycloak-server</directory>
                <includes>
                    <include>server/**</include>
                </includes>
            </fileset>
        </filesets>
    </configuration>
</plugin>

Appearently the maven-clean-plugin failes to remove the directory entirely and leaves the vite@5.1.0_@types+node@20.11.17_lightningcss@1.23.0 empty. The following step pnpm install --prefer-offline --frozen-lockfile --ignore-scripts of the admin-ui then fails to find this package.json.

I’m facing the same problem while building keycloak 25 and 26 on windows, tried the above pom.xml solution, but it didn’t work for me. is there any alternative way this could be build?
help is highly appreciated.
Thanks.