nestjs / typeorm

TypeORM module for Nest framework (node.js) 🍇

Home Page:https://nestjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

typeorm import not working?

Here2Huynh opened this issue · comments

I'm submitting a...


[x] Regression 
[ ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Importing typeorm from nestjs gives errors below.
First time running typeorm to connect to postgres.
image

Expected behavior

To import and successfully compile like instructed in documentation.
https://docs.nestjs.com/techniques/database#async-configuration

Minimal reproduction of the problem with instructions

logs from compiler:
[11:00:54 PM] Starting compilation in watch mode...

node_modules/@nestjs/typeorm/index.d.ts:1:15 - error TS2307: Cannot find module './dist' or its corresponding type declarations.

1 export * from './dist';
~~~~~~~~

src/app.module.ts:1:10 - error TS2305: Module '"../node_modules/@nestjs/typeorm"' has no exported member 'TypeOrmModule'.

1 import { TypeOrmModule } from '@nestjs/typeorm';
~~~~~~~~~~~~~

[11:00:58 PM] Found 2 errors. Watching for file changes.

package.json:
"dependencies": {
"@nestjs/common": "^7.5.1",
"@nestjs/core": "^7.5.1",
"@nestjs/platform-express": "^7.5.1",
"@nestjs/typeorm": "github:nestjs/typeorm",
"class-transformer": "^0.3.1",
"class-validator": "^0.12.2",
"mysql": "^2.18.1",
"pg": "^8.4.2",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^6.6.3",
"typeorm": "^0.2.29",
"uuid": "^8.3.1"
},

What is the motivation / use case for changing the behavior?

Environment


Nest version: 7.5.2

 
For Tooling issues:
- Node version: v14.10.0
- Platform:  Mac

Others:

VS Code, npm

Please provide a minimum reproduction repository.

Please provide a minimum reproduction repository.

Here it is:

https://github.com/Here2Huynh/Task-Manager-API.git

"@nestjs/typeorm": "github:nestjs/typeorm",

Instead of pulling this package directly from this repo, you should install it via the package manager. Otherwise, you'll have to manually build the package as the repo only contains TS source files - there are no JS files here and so index.{ts,js} re-exports the dist folder which in fact, doesn't even exist.

"@nestjs/typeorm": "github:nestjs/typeorm",

Instead of pulling this package directly from this repo, you should install it via the package manager. Otherwise, you'll have to manually build the package as the repo only contains TS source files - there are no JS files here and so index.{ts,js} re-exports the dist folder which in fact, doesn't even exist.

That make sense. Tried it and it works thanks!