Error: Cannot read properties of undefined (reading 'kind')

Hi,

I’m unable to run strapi locally (by npm run develop). The error I get is not very helpful

npm run develop

> app@0.1.0 develop
> strapi develop

Building your admin UI with development configuration...

✔ Webpack
  Compiled successfully in 1.49m

Admin UI built successfully
[2023-04-19 17:15:42.455] debug: ⛔️ Server wasn't able to start properly.
[2023-04-19 17:15:42.457] error: Cannot read properties of undefined (reading 'kind')
TypeError: Cannot read properties of undefined (reading 'kind')
    at isSingleType (/mnt/c/repos/strapi/node_modules/@strapi/utils/lib/content-types.js:90:25)
    at createRoutes (/mnt/c/repos/strapi/node_modules/@strapi/strapi/lib/core-api/routes/index.js:6:7)
    at Object.get routes [as routes] (/mnt/c/repos/strapi/node_modules/@strapi/strapi/lib/factories.js:59:31)
    at Object.addCreateLocalizationAction (/mnt/c/repos/strapi/node_modules/@strapi/plugin-i18n/server/services/core-api.js:184:41)
    at /mnt/c/repos/strapi/node_modules/@strapi/plugin-i18n/server/register.js:78:22
    at Array.forEach (<anonymous>)
    at extendLocalizedContentTypes (/mnt/c/repos/strapi/node_modules/@strapi/plugin-i18n/server/register.js:56:38)
    at Object.module.exports [as register] (/mnt/c/repos/strapi/node_modules/@strapi/plugin-i18n/server/register.js:12:3)
    at Object.register (/mnt/c/repos/strapi/node_modules/@strapi/strapi/lib/core/domain/module/index.js:47:46)
    at Object.register (/mnt/c/repos/strapi/node_modules/@strapi/strapi/lib/core/registries/modules.js:33:19)

npm run build doesn’t return any errors.

System Information
  • Strapi Version: 4.5.2
  • Operating System: Windows 10 / WSL 2 (Ubuntu 20)
  • Database: mysql
  • Node Version: 16.18.1
  • NPM Version: 8.19.2
  • Yarn Version: irrelevant

1 Like

Turns out directory name of new singleton in /api was not matching directory name in content-types/.

My fault, but error handling on strapi’s side could be improved too (add some sort of codelint before attempting to build & run?)

I agree that ye there should be a better error message for this.

1 Like

Whenever there is a file in a directory which is not being expected to be there, this error is thrown. One should maybe catch it and/or show an adequate error ?