I'm getting an error when execute "forge create": Failed to fetch templates

Hi :wave:

I’m following this guide https://developer.atlassian.com/platform/forge/getting-started/#hello-world-cli-overview in the second step “forge create” after entering the name of the project forge is trying to download the templates and I’m getting this error:

Getting template list...

Error: Failed to fetch templates, try running the command again.

Error: Failed to fetch templates, try running the command again.
    at TemplateServiceLister.getAvailableTemplates (/opt/homebrew/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/apps/template.js:106:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async CreateAppCommand.getAvailableTemplates (/opt/homebrew/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/apps/create-an-app.js:24:36)
    at async CommandLineUI.displayTemporaryMessage (/opt/homebrew/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/ui/command-line-ui.js:76:28)
    at async createCommandHandler (/opt/homebrew/lib/node_modules/@forge/cli/out/command-line/register-app-commands.js:63:27)
    at async Command.actionProcessor (/opt/homebrew/lib/node_modules/@forge/cli/out/command-line/command.js:76:32)

Can you please help me here?

Thanks

Hi @AdrianPlaza! Did you try to run the command again?
If it continues, could you try running forge create --verbose and provide the error you’re facing?

Hi vdebone,

Thanks for your help, The lines that I put in my initial comment are the lines that I’m getting when executing the command “forge create --verbose”.

Regards,
Adrián.

Thanks, last thing I’d ask is to confirm:

  1. Do you see version 6.11.0 when you run forge --version
  2. Can you access directly https://forge-templates.us-west-2.prod.public.atl-paas.net/templates.json?

Hi,

No, when I execute forge --version I get: 4.1.1 and about the URL yes I can access it without problems the content is:

[
  {
    "name": "blank"
  },
  {
    "name": "compass-admin-page-custom-ui"
  },
....

Regards,
Adrián.

Great, so I think if you update your @forge/cli by running the command npm i -g @forge/cli (if you used npm to install it), this issue should be fixed.

1 Like

Hi,

I execute the command npm i -g @forge/cli and this is the result added 590 packages in 10m but after this I executed the command forge --version and the result is still 4.1.1.

Any ideas why? can I use another tool instead of npm to install/update forge?

Regards,
Adrián.

This is not Forge specific, as it will depend on your environment. Here are some ideas that could help you unblock yourself:

  • It could be that you installed npm through a version manager that is switching between npm versions.
  • One possible way to verify what libs you have installed is npm list -g.
  • Also which forge and which npm could point out which binaries are you running when you run these commands, helping you figure out if you are running the code that you think you are running.

I hope that helps.

Hi vdebone,

Uninstalling and installing again the package npm i -g @forge/cli made the trick thanks for your help.

Regards,
Adrián.

1 Like