Strapi with --typescript option and docker postgres image TypeError reading 'routes'

I’m trying to do a custom install of strapi using these instructions.

#Launching a new site locally with a PostgreSQL database on docker. 

Start the docker database

1. Open docker desktop
2. start the previously initialized container. 

If not already done, this is the command:
docker run --name some-postgres -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -d postgres


#Test the docker connection. 

1. Open DBeaver to test connection. 
Use:

Host: localhost
Port: 5432
Database Name: postgres
Database: postgres
Username: postgres
password: mysecretpassword


if DBeaver successfully connects the database is working. 


#Spin up a new strapi instance

1. run this command
yarn create strapi-app zips --template corporate --typescript

2.  Choose Custom (Manual settings) when propted. 

3, Choose PostgreSQL for database type
Host: localhost
Port: 5432
Database Name: postgres
Database: postgres
Username: postgres
password: mysecretpassword

#now go into the project folder. 

cd my-ap
yarn install
yarn build
yarn run develop

Whether I go through the process with yarn or npm run develop, I’m getting the following errors.

> zips@0.1.0 develop
> strapi develop

Starting the compilation for TypeScript files in E:\Github\juke-strapi2\zips
TypeError: Cannot read properties of undefined (reading 'routes')
    at Object.addCreateLocalizationAction (E:\Github\juke-strapi2\zips\node_modules\@strapi\plugin-i18n\server\services\core-api.js:189:41)
    at E:\Github\juke-strapi2\zips\node_modules\@strapi\plugin-i18n\server\register.js:78:22
    at Array.forEach (<anonymous>)
    at extendLocalizedContentTypes (E:\Github\juke-strapi2\zips\node_modules\@strapi\plugin-i18n\server\register.js:56:38)
    at Object.module.exports [as register] (E:\Github\juke-strapi2\zips\node_modules\@strapi\plugin-i18n\server\register.js:12:3)
    at Object.register (E:\Github\juke-strapi2\zips\node_modules\@strapi\strapi\lib\core\domain\module\index.js:47:46)
    at Object.register (E:\Github\juke-strapi2\zips\node_modules\@strapi\strapi\lib\core\registries\modules.js:33:19)
    at async Strapi.runLifecyclesFunctions (E:\Github\juke-strapi2\zips\node_modules\@strapi\strapi\lib\Strapi.js:546:5)
    at async Strapi.register (E:\Github\juke-strapi2\zips\node_modules\@strapi\strapi\lib\Strapi.js:407:5)
    at async Strapi.load (E:\Github\juke-strapi2\zips\node_modules\@strapi\strapi\lib\Strapi.js:492:5)
PS E:\Github\juke-strapi2\zips>

I just tried it without typescript and it spun up. That’s the only change I made from my instructions.

yarn create strapi-app test_nots --template corporate

While it did spin up, I received many errors.

So is there something wrong with typescript and postgres that would cause my initial error? I’d love to stay with typescript on my project.

PS E:\Github\juke-strapi2\test_nots> yarn develop
yarn run v1.22.19
$ strapi develop
[2023-08-09 06:34:43.855] info: The Users & Permissions plugin automatically generated a jwt secret and stored it in .env under the name JWT_SECRET.
YupValidationError: Cannot read properties of undefined (reading 'uid')
    at handleYupError (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:86:11)
    at E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:98:13
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:156:23)
    at async Object.<anonymous> (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:415:20)
    at async createEntry (E:\Github\juke-strapi2\test_nots\src\bootstrap.js:93:26)
    at async E:\Github\juke-strapi2\test_nots\src\bootstrap.js:195:5 {
  details: { errors: [ [Object] ] }
}
YupValidationError: Cannot read properties of undefined (reading 'uid')
    at handleYupError (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:86:11)
    at E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:98:13
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:156:23)
    at async Object.<anonymous> (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:415:20)
    at async createEntry (E:\Github\juke-strapi2\test_nots\src\bootstrap.js:93:26)
    at async E:\Github\juke-strapi2\test_nots\src\bootstrap.js:195:5 {
  details: { errors: [ [Object] ] }
}
YupValidationError: Cannot read properties of undefined (reading 'uid')
    at handleYupError (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:86:11)
    at E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:98:13
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:156:23)
    at async Object.<anonymous> (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:415:20)
    at async createEntry (E:\Github\juke-strapi2\test_nots\src\bootstrap.js:93:26)
    at async E:\Github\juke-strapi2\test_nots\src\bootstrap.js:195:5 {
  details: { errors: [ [Object] ] }
}

 Project information

┌────────────────────┬──────────────────────────────────────────────────┐
│ Time               │ Wed Aug 09 2023 06:34:46 GMT-0400 (Eastern Dayl… │
│ Launched in        │ 11351 ms                                         │
│ Environment        │ development                                      │
│ Process PID        │ 22052                                            │
│ Version            │ 4.12.1 (node v16.16.0)                           │
│ Edition            │ Community                                        │
│ Database           │ postgres                                         │
└────────────────────┴──────────────────────────────────────────────────┘

 Actions available

One more thing...
Create your first administrator 💻 by going to the administration panel at:

┌─────────────────────────────┐
│ http://localhost:1337/admin │
└─────────────────────────────┘

YupValidationError: 1 relation(s) of type api::page.page associated with this entity do not exist
    at handleYupError (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:86:11)
    at E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:98:13
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:156:23)
    at async Object.<anonymous> (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:415:20)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\plugin-i18n\server\services\entity-service-decorator.js:130:19)
    at async createEntry (E:\Github\juke-strapi2\test_nots\src\bootstrap.js:93:26)
    at async E:\Github\juke-strapi2\test_nots\src\bootstrap.js:174:5 {
  details: { errors: [ [Object] ] }
}
YupValidationError: 1 relation(s) of type api::page.page associated with this entity do not exist
    at handleYupError (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:86:11)
    at E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:98:13
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:156:23)
    at async Object.<anonymous> (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:415:20)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\plugin-i18n\server\services\entity-service-decorator.js:130:19)
    at async createEntry (E:\Github\juke-strapi2\test_nots\src\bootstrap.js:93:26)
    at async E:\Github\juke-strapi2\test_nots\src\bootstrap.js:174:5 {
  details: { errors: [ [Object] ] }
}
YupValidationError: 1 relation(s) of type api::page.page associated with this entity do not exist
    at handleYupError (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:86:11)
    at E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:98:13
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:156:23)
    at async Object.<anonymous> (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:415:20)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\plugin-i18n\server\services\entity-service-decorator.js:130:19)
    at async createEntry (E:\Github\juke-strapi2\test_nots\src\bootstrap.js:93:26)
    at async E:\Github\juke-strapi2\test_nots\src\bootstrap.js:174:5 {
  details: { errors: [ [Object] ] }
}
YupValidationError: 1 relation(s) of type api::page.page associated with this entity do not exist
    at handleYupError (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:86:11)
    at E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:98:13
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:156:23)
    at async Object.<anonymous> (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:415:20)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\plugin-i18n\server\services\entity-service-decorator.js:130:19)
    at async createEntry (E:\Github\juke-strapi2\test_nots\src\bootstrap.js:93:26)
    at async E:\Github\juke-strapi2\test_nots\src\bootstrap.js:174:5 {
  details: { errors: [ [Object] ] }
}
YupValidationError: 1 relation(s) of type api::page.page associated with this entity do not exist
    at handleYupError (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:86:11)
    at E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:98:13
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:156:23)
    at async Object.<anonymous> (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:415:20)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\plugin-i18n\server\services\entity-service-decorator.js:130:19)
    at async createEntry (E:\Github\juke-strapi2\test_nots\src\bootstrap.js:93:26)
    at async E:\Github\juke-strapi2\test_nots\src\bootstrap.js:174:5 {
  details: { errors: [ [Object] ] }
}
YupValidationError: 1 relation(s) of type api::page.page associated with this entity do not exist
    at handleYupError (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:86:11)
    at E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:98:13
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:156:23)
    at async Object.<anonymous> (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:415:20)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\plugin-i18n\server\services\entity-service-decorator.js:130:19)
    at async createEntry (E:\Github\juke-strapi2\test_nots\src\bootstrap.js:93:26)
    at async E:\Github\juke-strapi2\test_nots\src\bootstrap.js:174:5 {
  details: { errors: [ [Object] ] }
}
YupValidationError: 1 relation(s) of type api::global.global associated with this entity do not exist
    at handleYupError (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:86:11)
    at E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:98:13
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:156:23)
    at async Object.<anonymous> (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:415:20)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\plugin-i18n\server\services\entity-service-decorator.js:130:19)
    at async createEntry (E:\Github\juke-strapi2\test_nots\src\bootstrap.js:93:26)
    at async E:\Github\juke-strapi2\test_nots\src\bootstrap.js:189:5 {
  details: { errors: [ [Object] ] }
}
YupValidationError: 1 relation(s) of type api::global.global associated with this entity do not exist
    at handleYupError (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:86:11)
    at E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:98:13
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:156:23)
    at async Object.<anonymous> (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:415:20)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\plugin-i18n\server\services\entity-service-decorator.js:130:19)
    at async createEntry (E:\Github\juke-strapi2\test_nots\src\bootstrap.js:93:26)
    at async E:\Github\juke-strapi2\test_nots\src\bootstrap.js:189:5 {
  details: { errors: [ [Object] ] }
}
[2023-08-09 06:34:49.903] http: GET /admin (84 ms) 200
[2023-08-09 06:34:49.996] http: GET /admin/main.ca36d041.js (9 ms) 200
[2023-08-09 06:34:50.001] http: GET /admin/runtime~main.a75ca9b7.js (41 ms) 200
[2023-08-09 06:34:51.071] http: GET /admin/project-type (8 ms) 200
[2023-08-09 06:34:51.107] http: GET /admin/2461.d5a4dbe2.chunk.js (13 ms) 200
[2023-08-09 06:34:51.109] http: GET /admin/5205.b59f05ff.chunk.js (12 ms) 200
[2023-08-09 06:34:51.110] http: GET /admin/admin-app.617885a9.chunk.js (5 ms) 200
[2023-08-09 06:34:51.167] http: GET /admin/en-json.2f3fce4a.chunk.js (6 ms) 200
[2023-08-09 06:34:51.169] http: GET /admin/fr-json.d55b289d.chunk.js (4 ms) 200
[2023-08-09 06:34:51.213] http: GET /admin/content-type-builder-translation-en-json.8ba63b4f.chunk.js (16 ms) 200
[2023-08-09 06:34:51.214] http: GET /admin/content-type-builder-translation-fr-json.c9cb32f4.chunk.js (13 ms) 200
[2023-08-09 06:34:51.218] http: GET /admin/email-translation-en-json.15710057.chunk.js (12 ms) 200
[2023-08-09 06:34:51.244] http: GET /admin/email-translation-fr-json.28f038a3.chunk.js (13 ms) 200
[2023-08-09 06:34:51.245] http: GET /admin/upload-translation-en-json.a4626bc0.chunk.js (9 ms) 200
[2023-08-09 06:34:51.246] http: GET /admin/upload-translation-fr-json.fb5de04f.chunk.js (5 ms) 200
[2023-08-09 06:34:51.263] http: GET /admin/graphql-translation-en-json.bd5be001.chunk.js (11 ms) 200
[2023-08-09 06:34:51.264] http: GET /admin/graphql-translation-fr-json.53fd7a32.chunk.js (5 ms) 200
[2023-08-09 06:34:51.264] http: GET /admin/users-permissions-translation-en-json.97abe2ab.chunk.js (3 ms) 200
[2023-08-09 06:34:51.286] http: GET /admin/users-permissions-translation-fr-json.920e36fc.chunk.js (11 ms) 200
[2023-08-09 06:34:51.288] http: GET /admin/i18n-translation-en-json.a99c2c4a.chunk.js (10 ms) 200
[2023-08-09 06:34:51.292] http: GET /admin/i18n-translation-fr-json.03d19607.chunk.js (12 ms) 200
YupValidationError: 1 relation(s) of type api::page.page associated with this entity do not exist
    at handleYupError (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:86:11)
    at E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:98:13
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:156:23)
    at async Object.<anonymous> (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:415:20)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\plugin-i18n\server\services\entity-service-decorator.js:130:19)
    at async createEntry (E:\Github\juke-strapi2\test_nots\src\bootstrap.js:93:26)
    at async E:\Github\juke-strapi2\test_nots\src\bootstrap.js:174:5 {
  details: { errors: [ [Object] ] }
}
[2023-08-09 06:34:51.570] http: GET /admin/init (23 ms) 200
[2023-08-09 06:34:51.593] http: GET /admin/telemetry-properties (6 ms) 401
YupValidationError: 1 relation(s) of type api::page.page associated with this entity do not exist
    at handleYupError (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:86:11)
    at E:\Github\juke-strapi2\test_nots\node_modules\@strapi\utils\dist\validators.js:98:13
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:156:23)
    at async Object.<anonymous> (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\strapi\lib\services\entity-service\index.js:415:20)
    at async Object.create (E:\Github\juke-strapi2\test_nots\node_modules\@strapi\plugin-i18n\server\services\entity-service-decorator.js:130:19)
    at async createEntry (E:\Github\juke-strapi2\test_nots\src\bootstrap.js:93:26)
    at async E:\Github\juke-strapi2\test_nots\src\bootstrap.js:174:5 {
  details: { errors: [ [Object] ] }
}
[2023-08-09 06:34:51.727] http: GET /admin/70674f63fc3904c20de0.svg (2 ms) 200

I just read the change log for 4.12 and it says

I’ll need to update my node version with nvm and see if that fixes the issues! I do feel like the documentation is good but a bit spread out all over the place.

What’s the recommended version of node?

Unfortunately, using node 20.4.0 did not resolve the error on yarn develop.

PS E:\Github\juke-strapi2\zips> yarn develop
yarn run v1.22.19
$ strapi develop
Starting the compilation for TypeScript files in E:\Github\juke-strapi2\zips
(node:2720) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [TLSSocket]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
TypeError: Cannot read properties of undefined (reading 'routes')
    at Object.addCreateLocalizationAction (E:\Github\juke-strapi2\zips\node_modules\@strapi\plugin-i18n\server\services\core-api.js:189:41)
    at E:\Github\juke-strapi2\zips\node_modules\@strapi\plugin-i18n\server\register.js:78:22
    at Array.forEach (<anonymous>)
    at extendLocalizedContentTypes (E:\Github\juke-strapi2\zips\node_modules\@strapi\plugin-i18n\server\register.js:56:38)
    at module.exports [as register] (E:\Github\juke-strapi2\zips\node_modules\@strapi\plugin-i18n\server\register.js:12:3)
    at Object.register (E:\Github\juke-strapi2\zips\node_modules\@strapi\strapi\lib\core\domain\module\index.js:47:46)
    at Object.register (E:\Github\juke-strapi2\zips\node_modules\@strapi\strapi\lib\core\registries\modules.js:33:19)
    at async Strapi.runLifecyclesFunctions (E:\Github\juke-strapi2\zips\node_modules\@strapi\strapi\lib\Strapi.js:546:5)
    at async Strapi.register (E:\Github\juke-strapi2\zips\node_modules\@strapi\strapi\lib\Strapi.js:407:5)
    at async Strapi.load (E:\Github\juke-strapi2\zips\node_modules\@strapi\strapi\lib\Strapi.js:492:5)
Done in 263.95s.

Do you get the error also if you install the project outside of the docker instance?

Do you have any backend customization in your project?

This is not in a docker image. Docker is hosting the postgres with postgis database, which is what my project requires. The strapi instance is just inside my windows 10 file system and is executed via yarn. I also tried it using Linux wsl and got the same errors.

This happens with no additional plugins or modifications added at all. Just an install with typescript and postgres as the database. As detailed in the steps listed above.

I can perform the exact same steps without typescript and with postgres and it works just fine. So it appears to me to have something to do with the typescript option.

PS. I’ve been using the corporate template… I’ll try tomorrow without the corporate template and see if that changes anything.

Ah, look at that! Spinning up without the ‘–template corporate’ option worked! There must be some issues with the corporate template alongside of the typescript version of strapi 4.12.4 (node 20.5.0) because other than that, I’ve made no changes.