New Custom Project :yarninstall error

Hi all I posted this in another thread but I am adding it here as a new thread rather in the hope that it gets noticed

When I followed the “Creating Custom Project” verbatim I encountered an issue where Gradle could not find the task “:agent” in the “myextention1/build.gradle” line 6. I am new to gradle but I think I am figuring it out what its doing and I changed that to “:openremote:agent” and it worked.

Then when I got the clean to work and the installDist target to build the installDist target fails at around 63% specifically at “:yarnInstall” task more specifically at the below error point. Is it struggling to install those “polymer” related dependencies? I am a gradle noob and a basical level nodejs user and I am using a Windows 10 Machine with Docker Desktop.

 warning workspace-aggregator-5c9f8a42-c010-4219-a822-d0614bf01dee > demo > webpack > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated	
> error Couldn't find any versions for "@polymer/promise-polyfill" that matches "gloo"	
> info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.	
> Error: Couldn't find any versions for "@polymer/polymer" that matches "preview"	
>     at MessageError.ExtendableBuiltin (C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:721:66)	
>     at new MessageError (C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:750:123)	
>     at Function.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:50546:13)	
>     at Generator.next (<anonymous>)	
>     at step (C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:310:30)	
>     at C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:321:13	
> Error: Couldn't find any versions for "@polymer/polymer" that matches "preview"	
>     at MessageError.ExtendableBuiltin (C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:721:66)	
>     at new MessageError (C:\user\Peter\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:750:123)	
>     at Function.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:50546:13)	
>     at Generator.next (<anonymous>)	
>     at step (C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:310:30)	
>     at C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:321:13	
> Error: Couldn't find any versions for "@polymer/polymer" that matches "preview"	
>     at MessageError.ExtendableBuiltin (C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:721:66)	
>     at new MessageError (C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:750:123)	
>     at Function.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:50546:13)	
>     at Generator.next (<anonymous>)	
>     at step (C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:310:30)	
>     at C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:321:13	
> Error: Couldn't find any versions for "@polymer/polymer" that matches "preview"	
>     at MessageError.ExtendableBuiltin (C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:721:66)	
>     at new MessageError (C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:750:123)	
>     at Function.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:50546:13)	
>     at Generator.next (<anonymous>)	
>     at step (C:\Users\user\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:310:30)

Hi,

Apologies for the late reply.

Looks like the Creating a custom project guide needs some updating as looking at it now it assumes you also create a custom agent module (which would be where you would write custom protocol implementations), you can simply remove the compile dependency from your build.gradle:

i.e. remove this:

// Agent and protocol SPI
compile project(":agent")

The issue with yarn install is related to some old/bad Polymer 2.x dependencies which use version numbers in their dependencies that don’t actually exist in npm, you can copy the yarn.lock from the openremote dir/repo into the root of your custom project and then yarn install will be able to run without manual intervention to resolve missing version.

I will update the wiki to prevent others getting stuck here also.

Thanks this fixed things only one issue I still have is that this line gives an error

// Setup SPI

compile project(":openremote:manager:server")

when I remove “server” and change it to “:openremote:manager:” it builds but then the server container doesnt get created and I only have the Postgresql and Keycloak containers.

Indeed that should be:

compile project(":openremote:manager")

I’ve updated the wiki page now.

For a custom project it is the deployment image that contains your customisations, the manager image is still the same standard image that gets pushed to docker hub. When you do:

./gradlew clean installDist

You should end up with a deployment/build/manager/extensions dir that contains your customised code compiled and packaged into jar files. You then build the deployment image from the Dockerfile in the deployment dir, so the full set of docker containers is:

proxy
postgresql
keycloak
manager
deployment

Hope this clears things up.

Please note that there was another error in the extension gradle build file information which has now been fixed so please double check your extensions build.gradle against the latest in: