System Information
-
Strapi Version: 4
-
Operating System: macos
-
Database:
-
Node Version: 18.12.1
-
NPM Version: 9.2.0
-
Yarn Version:
Hello everyone, I have a big problem, my hard drive crashed and I lost all my data. After changing my hard drive, I cloned my Strapi Next.js project but Strapi won’t launch with an error on the APP KEYS that I no longer have. How can I recover my Strapi admin? Thank you all.
You will need to create your .env file if it’s a fresh project cloned down.
You just create random strings for the different values there should be an .env.example file you can look at in the project unless you deleted it
1 Like
Thank you so much ! It’s good !
Just so it’s a bit clearer for future searchers, as I ran into the same problem.
Create an .env file in the base directory of the project.
Add these values to it:
APP_KEYS={random-string-doesn’t-matter}
API_TOKEN_SALT={random-string-doesn’t-matter}
After this, everything works flawlessly.
Hi, thanks for the solution. I have some comments that could improve the user experience though.
- Couldn’t the .env file be automatically generated?
- If not, it would be great to have an explanation on the terminal of what the user is supposed to do (create the .env file). Or at least a link to a strapi url that explains it. Having to copy the error, and paste it in google to find a solution is not a good user experience.
- Also the explanation should be in the readme.md, as it will be quite common for developers working on the repo/project to run against this issue.
Hi @brsastre
glad for the feedback 
Just to let you know, the env file is auto-generated when using the CLI
tool not cloning it down. (you want to use the CLI tool to create your project). The user here had cloned down their own repo meaning the .env
would not exist as it’s not to be committed to github.
Could be explained in the documentation indeed, feel free to make a PR here GitHub - strapi/documentation: Strapi Documentation and add some 
Should also be explained some information regarding .env
and the environmental variables in our documentation.
Hi @Eventyret thank you for your feedback.
I think it would be quite common for more than one developer to be working on a strapi project. Suppose I created my strapi project with no problems, and I push the repo to github. Then developer-2 clones the repo and wants to start working on it.
What steps should developer-2 take to run strapi?
Create a .env
file there should be an .env.exmaple
that is committed.
And depending on your database if you are using sqlite for development then they only need to run yarn install or npm install then run it.
The issue should be also that the file environment name it isn’t the same;
just change .env.example → .env