ljlm0402 / typescript-express-starter

📘 Quick and Easy TypeScript Express Starter
http://npm.im/typescript-express-starter
MIT License
2.72k stars 419 forks source link

Routing Controllers template: defaultMetadataStorage moved from class-transformer to class-transformer/types/storage #179

Closed wKoja closed 2 years ago

wKoja commented 2 years ago

The bug:

After choosing the routing controllers during installation, the following error is caught in the app.ts file:

image

After doing some digging in the lib, I found that this export is actually within class-transformer/types/storage, and when I reflect that in the import, the error goes away:

image

Version:

I'm on version 9.2.0

Steps to reproduce:

  1. Install the library and choose the routing-controllers option
  2. Open the app.ts file
wKoja commented 2 years ago

Well, the diagnostics error goes away, but the server ends up crashing:

Error: Cannot find module 'class-transformer/types/storage'
Require stack:
- /home/koja/Projects/misc/nodejs-ts/src/app.ts
- /home/koja/Projects/misc/nodejs-ts/src/server.ts
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue (/home/koja/Projects/misc/nodejs-ts/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._resolveFilename (/home/koja/Projects/misc/nodejs-ts/node_modules/tsconfig-paths/src/register.ts:115:36)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Module.require (node:internal/modules/cjs/loader:1022:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/koja/Projects/misc/nodejs-ts/src/app.ts:3:1)
    at Module._compile (node:internal/modules/cjs/loader:1120:14)
    at Module.m._compile (/home/koja/Projects/misc/nodejs-ts/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1174:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/koja/Projects/misc/nodejs-ts/src/app.ts',
    '/home/koja/Projects/misc/nodejs-ts/src/server.ts'
  ]
}
[nodemon] app crashed - waiting for file changes before starting...
[nodemon] restarting due to changes...
[nodemon] starting `ts-node -r tsconfig-paths/register --transpile-only src/server.ts`