System Information
- Strapi Version: 5.4.0
- Operating System: macOS
- Database: SQLite
- Node Version: v20.17.0
- NPM Version: 10.8.2
- Yarn Version: not used
Description:
Hello everyone,
I’m encountering an issue when trying to create a custom policy using the following command:
npm run strapi generate
When I select “Generate a policy for an API” and name the policy is-admin
, I reach the step where it asks “Where do you want to add this policy?”. When I choose “Add policy to an existing API”, I get the following error:
[ERROR] Couldn't find an "api" directory
However, I do have a src/api/
folder in my project, containing subfolders like post
, menu
, header
, etc., which are my various APIs.
What I’ve Checked So Far:
- Directory Structure: The
src/api/
folder is definitely present and contains subfolders with the API files. - Dependencies Integrity: I ran
npm install
and verified there are no vulnerabilities (npm audit
shows 0 vulnerabilities). - Correct Naming of Folders: I have made sure the folder name is correctly spelled (
api
in lowercase), and everything seems to be named properly. - Build Process: I ran
npm run build
to ensure everything was properly compiled.
I cannot figure out why Strapi cannot find these APIs so I can add my new policy.
Has anyone else encountered this issue? Or could anyone help me figure this out? I really appreciate any assistance you can provide.
Thank you!