Sitecore XM Cloud Local Setup Errors

👋 Hi!

It’s time for XM Cloud 🌥️ in this Blog!

After a long and tiring May, I found a short time on the last day to put my hands-on this new piece of technology provided by Sitecore.

I decided to prepare my local computer to run locally the Sitecore XM Cloud.

To set up my local environment, I followed the XM Cloud Tutorial Series created by Sebastian Winter. You can watch it here.

During this process, I encountered several errors, mostly related to environment issues. Let’s take a look at 5 common problems and their solutions.

Before diving into the issues, I recommend checking out the pre-requisites. This article by David Austin from FishTank is a great resource for reviewing any details that might have been missed in the video.

The first issue that I faced was:

PowerShell
Register-PSRepository : The specified Uri 'https://nuget.sitecore.com/resources/v2' for parameter 'SourceLocation' is
an invalid Web Uri. Please ensure that it meets the Web Uri requirements.
At C:\dev\xm-cloud-demo\init.ps1:49 char:5
+     Register-PSRepository -Name SitecoreGallery -SourceLocation https ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (https://nuget.sitecore.com/resources/v2:String) [Register-PSRepository
   ], ArgumentException
    + FullyQualifiedErrorId : InvalidWebUri,Register-PSRepository

Solutions:

  1. Restart your computer – Surprisingly, this worked for me. Sometimes the console needs a ‘refresh’ to function properly
  2. StackOverflow Workaround – Check this comment on StackOverflow for an alternative solution.
  3. Change the Installation Policy – Modify the policy from Trusted to Untrusted at line 49 in init.ps1.
  4. Update PowerShell – Ensure you have a newer version of PowerShell (> 5 version).

Then, I got this error:

PowerShell
PS C:\Dev\xm-cloud-demo> .\up.ps1
Expiration 01/01/2100 00:00:00
The license is valid. 27607 days left until expiration.
Set-EnvFileVariable: C:\Dev\xm-cloud-demo\up.ps1:34:5
Line |
  34 |      Set-EnvFileVariable "NODEJS_VERSION" -Value $xmCloudBuild.renderi …
     |      ~~~~~~~~~~~~~~~~~~~
     | The term 'Set-EnvFileVariable' is not recognized as a name of a cmdlet, function, script file, or executable
     | program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Which has a very simple solution:

  • Run your IDE or console app in a Administrator Mode.

At least, this was easier.

PowerShell
Building containers...
time="2024-05-31T11:59:09-03:00" level=warning msg="The \"SITECORE_XmCloud_dot_TenantId\" variable is not set. Defaulting to a blank string."
error during connect: in the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/_ping": open //./pipe/docker_engine: The system cannot find the file specified.
Write-Error: Container build failed, see errors above.

Solution:

As pointed by David Austin, the solution is:

If you encounter the following error this is due to the Windows Container not running. If you check Docker in the system tray most likely your still on Linux Containers.

So just Run the Docker application, don’t forget to run the Docker service, and switch from Linux to Windows containers.

Yeah, we still have problems within the Up.ps1. The error:

PowerShell
Error response from daemon: failed to create endpoint sxastarter-traefik-1 on network sxastarter_default: failed during hnsCallRawResponse: hnsCall failed in Win32: The process cannot access the file because it is being used by another process. (0x20)
Waiting for CM to become available...
Invoke-RestMethod: C:\Dev\xm-cloud-demo\up.ps1:67:19
Line |
  67 |  …   $status = Invoke-RestMethod "http://localhost:8079/api/http/routers …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | No connection could be made because the target machine actively refused it.

Solution:

This issue is due to the Traefik container attempting to use the same port as another application. Try the following:

  1. In a console, type iisreset /stop.
  2. Stop all services related to Sitecore, Solr, and SQL Server

No way? Still seeing errors? Then I recommend a ‘hard reset’

In a console, type the following:

  • docker-compose stop
  • docker-compose down
  • iisreset /stop
  • docker network prune
  • .\init.ps1
  • .\up.ps1

Somewhere down the road I faced this one:

PowerShell
Waiting for CM to become available...
Write-Error: Timeout waiting for Sitecore CM to become available via Traefik proxy. Check CM container logs.

And found the Erica’s answers.

  1. Check the health of your containers and ensure there are no errors.
  1. All good? So you should be able to see the initial launchpad:

See you!

Leave a Reply

Your email address will not be published. Required fields are marked *