When I run the following commands:
❯ node --version
v16.19.0
❯ yarn --version
3.5.0
I am attempting to launch this project:
https://github.com/felipebelinassi/typescript-graphql-boilerplate
However, when I execute:
yarn db:migrate
which runs the command:
ts-node typeorm migrations:generate -n
it fails with the error message displayed below:
❯ yarn db:migrate
node:internal/modules/cjs/loader:998
throw err;
^
Error: Cannot find module './typeorm'
Require stack:
- /Users/test/repos/typescript-graphql-boilerplate/imaginaryUncacheableRequireResolveScript
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
at Function.resolve (node:internal/modules/cjs/helpers:109:19)
at requireResolveNonCached (/Users/test/repos/typescript-graphql-boilerplate/node_modules/ts-node/dist/bin.js:549:16)
at getProjectSearchDir (/Users/test/repos/typescript-graphql-boilerplate/node_modules/ts-node/dist/bin.js:519:40)
at phase3 (/Users/test/repos/typescript-graphql-boilerplate/node_modules/ts-node/dist/bin.js:267:27)
at bootstrap (/Users/test/repos/typescript-graphql-boilerplate/node_modules/ts-node/dist/bin.js:47:30)
at main (/Users/test/repos/typescript-graphql-boilerplate/node_modules/ts-node/dist/bin.js:33:12)
at Object.<anonymous> (/Users/test/repos/typescript-graphql-boilerplate/node_modules/ts-node/dist/bin.js:579:5)
at Module._compile (node:internal/modules/cjs/loader:1165:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1219:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/test/repos/typescript-graphql-boilerplate/imaginaryUncacheableRequireResolveScript'
]
}
The contents of package.json are as follows:
{
"name": "typescript-graphql-boilerplate",
"version": "1.0.0",
"license": "ISC",
"description": "Simple TypeScript and GraphQL project boilerplate",
"author": "Felipe Belinassi",
"main": "index.js",
"scripts": {
"prebuild": "del-cli --force ./build",
"build": "tsc",
"prestart": "yarn build",
"start": "node -r dotenv/config build/app.js",
"start:dev": "ts-node-dev --transpile-only -r dotenv/config src/app.ts",
"test": "jest --projects ./tests/integration --runInBand",
"db:migrate": "ts-node typeorm migrations:generate -n"
},
"dependencies": {
"apollo-server-express": "^2.24.0",
"apollo-server-testing": "^2.24.0",
"class-validator": "^0.13.1",
"dotenv": "^9.0.0",
"express": "^4.17.1",
"graphql": "^15.5.0",
"joi": "^17.4.0",
"pg": "^8.11.3",
"reflect-metadata": "^0.1.13",
"type-graphql": "^1.1.1",
"typedi": "^0.8.0",
"typeorm": "^0.3.16",
"typeorm-typedi-extensions": "^0.4.1"
},
"devDependencies": {
"@types/express": "^4.17.11",
"@types/jest": "^26.0.23",
"@types/node": "^15.0.2",
"del-cli": "^3.0.1",
"jest": "^26.6.3",
"ts-jest": "^26.5.6",
"ts-node": "^10.9.1",
"ts-node-dev": "^2.0.0",
"typescript": "^5.2.2"
}
}
Any suggestions on how to resolve this issue? Postgres is running via docker-compose.
I have attempted to update dependencies but failed to populate the database with data. The issue appears to be related to TypeORM.