• 12-12-2022, 01:55:14
    #1
    Arkadaşlar node.js ile build işlemi yaparken şöyle bi hata alıyorum ;

    => ERROR [build 7/7] RUN npx nx build driver-api --prod 53.9s
    ------
    > [build 7/7] RUN npx nx build driver-api --prod:
    #12 5.267
    #12 5.268 > nx run driver-api:buildroduction
    #12 5.268
    #12 53.66 chunk (runtime: main) main.js (main) 348 KiB [entry] [rendered]
    #12 53.66
    #12 53.66 ERROR in /app/libs/database/src/lib/redis-pub-sub.provider.ts
    #12 53.66 ./libs/database/src/lib/redis-pub-sub.provider.ts 16:10-19
    #12 53.66 [tsl] ERROR in /app/libs/database/src/lib/redis-pub-sub.provider.ts(16,11)
    #12 53.66 TS2322: Type 'Redis' is not assignable to type 'RedisClient'.
    #12 53.66 Type 'Redis' is missing the following properties from type 'Redis': stream, isCluster, connector, reconnectTimeout, and 140 more.
    #12 53.66
    #12 53.66 ERROR in /app/libs/database/src/lib/redis-pub-sub.provider.ts
    #12 53.66 ./libs/database/src/lib/redis-pub-sub.provider.ts 17:10-20
    #12 53.66 [tsl] ERROR in /app/libs/database/src/lib/redis-pub-sub.provider.ts(17,11)
    #12 53.66 TS2322: Type 'Redis' is not assignable to type 'RedisClient'.
    #12 53.66
    #12 53.66 ERROR in libs/database/src/lib/redis-pub-sub.provider.ts:16:11
    #12 53.66 TS2322: Type 'Redis' is not assignable to type 'RedisClient'.
    #12 53.66 Type 'Redis' is missing the following properties from type 'Redis': stream, isCluster, connector, reconnectTimeout, and 140 more.
    #12 53.66 14 | };
    #12 53.66 15 | return new RedisPubSub({
    #12 53.66 > 16 | publisher: new Redis(options),
    #12 53.66 | ^^^^^^^^^
    #12 53.66 17 | subscriber: new Redis(options),
    #12 53.66 18 | })
    #12 53.66 19 | } ,
    #12 53.66
    #12 53.66 ERROR in libs/database/src/lib/redis-pub-sub.provider.ts:17:11
    #12 53.66 TS2322: Type 'Redis' is not assignable to type 'RedisClient'.
    #12 53.66 15 | return new RedisPubSub({
    #12 53.66 16 | publisher: new Redis(options),
    #12 53.66 > 17 | subscriber: new Redis(options),
    #12 53.66 | ^^^^^^^^^^
    #12 53.66 18 | })
    #12 53.66 19 | } ,
    #12 53.66 20 | };
    #12 53.66
    #12 53.66 webpack compiled with 4 errors (b984ccb820b8363c)
    #12 53.77
    #12 53.77
    #12 53.77
    #12 53.77 > NX Running target "driver-api:build" failed
    #12 53.77
    #12 53.77 Failed tasks:
    #12 53.77
    #12 53.77 - driver-api:buildroduction
    #12 53.77
    #12 53.77 Hint: run the command with --verbose for more details.
    #12 53.77


    hata ile ilgili dosya olan "redis-pub-sub.provider.ts(16,11)" şu şekilde ;

    import { pubSubToken } from '@nestjs-query/query-graphql';
    import { RedisPubSub } from 'graphql-redis-subscriptions';
    import Redis from 'ioredis';
    import { Provider } from '@nestjs/common';

    export class RedisPubSubProvider {
    static provider(): Provider {
    return {
    provide: pubSubToken(),
    useFactory: () => {
    const options = {
    host: process.env.REDIS_HOST || 'localhost',
    port: 6379
    };
    return new RedisPubSub({
    publisher: new Redis(options),
    subscriber: new Redis(options),
    })
    } ,
    };
    }
    }


    bu konuda yardımcı olabilecek arkadaşlar varsa sevinirim
  • 11-01-2023, 23:52:01
    #2
    Sorun, 'Redis' sınıfı ile 'RedisClient' sınıfı arasında özellikler bakımından uyumsuzluk olduğu için ortaya çıkar. Özellikle, 'RedisClient' sınıfındaki bazı özellikler 'Redis' sınıfında mevcut değil.
    şunları dikkate al

    en önce son versiyonlarını kullanmaya özen göster

    İlgili dosyadaki 'Redis' sınıfını 'RedisClient' sınıfına dönüştürerek kullanmayı dene.
    ioredis kütüphanesinin son sürümünü kullanmayı dene.
    ioredis kütüphanesinin 'RedisClient' sınıfını kullan.

    ioredis kütüphanesinin 'RedisClient' sınıfını kullanarak bir örnek oluşturuyorum ona göre örnek alabilirsin dostum buradaa ioredis kütüphanesini kullanarak, 'localhost' adresinde ve '6379' portunda bir Redis sunucusuna bağlanmak için bir RedisClient oluşturuyoruz.

    import Redis from 'ioredis';
    const redis = new Redis();
    
    // veya
    
    const options = {
        host: 'localhost',
        port: 6379,
    };
    const redis = new Redis(options);
  • 12-01-2023, 03:52:46
    #3
    DiZiNi adlı üyeden alıntı: mesajı görüntüle
    Sorun, 'Redis' sınıfı ile 'RedisClient' sınıfı arasında özellikler bakımından uyumsuzluk olduğu için ortaya çıkar. Özellikle, 'RedisClient' sınıfındaki bazı özellikler 'Redis' sınıfında mevcut değil.
    şunları dikkate al

    en önce son versiyonlarını kullanmaya özen göster

    İlgili dosyadaki 'Redis' sınıfını 'RedisClient' sınıfına dönüştürerek kullanmayı dene.
    ioredis kütüphanesinin son sürümünü kullanmayı dene.
    ioredis kütüphanesinin 'RedisClient' sınıfını kullan.

    ioredis kütüphanesinin 'RedisClient' sınıfını kullanarak bir örnek oluşturuyorum ona göre örnek alabilirsin dostum buradaa ioredis kütüphanesini kullanarak, 'localhost' adresinde ve '6379' portunda bir Redis sunucusuna bağlanmak için bir RedisClient oluşturuyoruz.

    import Redis from 'ioredis';
    const redis = new Redis();
    
    // veya
    
    const options = {
        host: 'localhost',
        port: 6379,
    };
    const redis = new Redis(options);
    tşkr ederim deneyeceğim