zhangyuang / ssr

A most advanced ssr framework support React17/React18/Vue2/Vue3 on Earth that implemented serverless-side render specification.
http://doc.ssr-fc.com/
MIT License
2.61k stars 284 forks source link

安装 typeorm 无法使用 #88

Closed WuYunlong closed 3 years ago

WuYunlong commented 3 years ago
  1. 安装依赖

    yarn add @nestjs/typeorm typeorm mysql2
  2. 引入配置 src/app.module.ts

    
    import { Module } from '@nestjs/common'
    import { DetailModule } from './modules/detail-page/detail.module'
    import { indexModule } from './modules/index-page/index.module'
    import { TypeOrmModule } from '@nestjs/typeorm'

@Module({ imports: [ TypeOrmModule.forRoot({ type: 'mysql', host: 'localhost', port: 3306, username: 'root', password: 'root', database: 'test', entities: [], synchronize: true }), DetailModule, indexModule ] }) export class AppModule {}


此时无法运行 程序报错 报错信息如下
``` bash
[Nest] 17028   - 08/03/2021, 2:57:46 PM   [NestFactory] Starting Nest application...

[Nest] 17028   - 08/03/2021, 2:57:46 PM   [InstanceLoader] AppModule dependencies initialized +26ms

[Nest] 17028   - 08/03/2021, 2:57:46 PM   [InstanceLoader] TypeOrmModule dependencies initialized +0ms

error: [Nest] 17028   - 08/03/2021, 2:57:46 PM   [ExceptionHandler] rxjs_1.lastValueFrom is not a function +1ms

error: TypeError: rxjs_1.lastValueFrom is not a function
    at Function.<anonymous> (/Users/macos/Desktop/ssr/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:146:33)
    at Generator.next (<anonymous>)
    at /Users/macos/Desktop/ssr/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:20:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/macos/Desktop/ssr/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:16:12)
    at Function.createConnectionFactory (/Users/macos/Desktop/ssr/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:143:16)
    at Function.<anonymous> (/Users/macos/Desktop/ssr/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:46:96)
    at Generator.next (<anonymous>)
    at /Users/macos/Desktop/ssr/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:20:71
    at new Promise (<anonymous>)

是不允许这样使用还是我的配置有问题。

WuYunlong commented 3 years ago

装7.1.5的@nestjs/typeorm 解决问题