Warning: An error occurred while requesting the API

System Information
  • Latest:
  • Ubuntu 18 and 20:
    -SQlite:
  • tested on 16 and 17:
    -test with 6 and 8*:
  • no yarn:

I am completely new to Strapi… I just wanted to start playing around I was not able to make it running. When I go to admin page to create a new first admin a I got for a few seconds error message Warning: An error occurred while requesting the API

I can se a few recent post here with similar problem but no solution… Anybody have an idea ? Or how to troubleshoot… I use fresh ubutu created in AWS lightsail… if you want to replicate it. just spinup one and install node and run npx create and you will be there as well.

Thanks

OK a bit of update… The first problem is that I used unsupported version of node and npm but it did not fail while installing 4.0.3 but the installation failed with 4.0.0. So from my perspective 4.0.3 should also fail… But I am still not able to make it working even I install npm 6 and node 14. The installation fails with error but there are just warnings so I have not idea what the error is…

16 and 17 are both “unsupported”
16 is supported but I believe it’s still a bug and you need to use yarn to install.
14 should work with npm.

sorry npm 6 and node 14 tested failed with error that is unclear… tried to use yarn after an hour installing I gave it up.
I got that 16 and 17 is not supported 4.0.3 just install without any single complain… 4.0.0 at least fails with errors…

I already moved to directus… thanks anyway…
Installation of directus… first try and finished in few minutes. Only issue that you have to create db first :frowning: but I would say this is a minor… i burned day with strapi…

1 Like

No no I Understand that sorry to hear about the experience.
I came from the other direction so :slight_smile:
I used directus few years back and changed.
Thank you for the feedback though, I’m sure the team will take it on board.

I had the same issue.
Running “yarn build” after installation helped.

Following:
Getting “Warning: An error occurred while requesting the API” when opening Strapi

4 Likes

I had the same experience as @mrwisu and yarn works, npm does not by default on windows especially when ports are changed

Working on Windows I changed my port to 8082 when installing Strapi with npm and mysql, after updating the port I got " Warning: An error occurred while requesting the API".

Fix was to $npm install -g yarn, $yarn build, then $npm run develop

Strapi did pull up the first try.

1 Like

If you are using node 16+ so far don’t use npm keep using yarn.
yarn develop = npm run develop
yarn add = npm install
yarn build = npm run build
@razorwebs

I’m using Node 16+ on FBSD 13. Had the same problem above.

Seems one is expected to build the app (npm run build). I did a build on development mode and the API error disappeared (and the login page renders). Now rebuilding on production mode.

Cautiously confident this is it. :slight_smile:

UPDATE: It works!

2 Likes

I’ve been using Strapi for years and have a bunch of projects connected to it. I have been snagged for a day and a half trying to fire up Strapi on a server I already have 5 other instances of Strapi running on, error after error, the template functionality has totally changed and a template from 3.6 does not work, even after using the npx script @3.6, resigned to rebuilding the whole copy of the strapi setup after a day I came to this error next, very discouraging im running a basic Unbuntu droplet on Digital Ocean. Was really hoping at least the newest version would be bug free.

Not sure how this fits i n here unless it’s the error that is the same ?

If you are using 3.5 you want to use the migration guides to make sure it’s on 3.6.8

I am using docker and indeed I need to do a build first before doing the yarn develop.
Thank you.

Hi, so I’m getting this error too. Strapi crashes after a certain period of inactivity I believe.
I’m using the latest strapi version. I’ve dockerized it as well. Kindly let me know please what am I missing here?

Node - v16.13.0
NPM - 8.1.0