Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install module #49

Open
Thelin90 opened this issue Dec 13, 2021 · 1 comment
Open

Can't install module #49

Thelin90 opened this issue Dec 13, 2021 · 1 comment
Assignees

Comments

@Thelin90
Copy link

Thelin90 commented Dec 13, 2021

Hello.

I am currently trying out your project.

Currently when I do:

package.json

{
  "name": "kafka-to-socket",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "tsc": "./node_modules/typescript/bin/tsc",
    "build": "tsc",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@types/node": "^12.20.37",
    "typescript": "^4.5.3"
  },
  "dependencies": {
    "kafka-socks": "0.1.10",
    "ts-node": "^10.4.0"
  }
}

And when I add:

import { Confluent, Consumer, Subject } from 'kafka-socks';

const express = require('express');
const http = require('http');
const { Server } = require('socket.io');

const app = express();
const server = http.createServer(app);
const io = new Server(server);

const KAFKA_BOOTSTRAP_SERVER = ['localhost:31659']
const kafka = new Confluent(KAFKA_BOOTSTRAP_SERVER).create("client-id");

const kafkaConsumer = kafka.consumer({ groupId:  "test-group" });
const kafkaSocksConsumer = new Consumer(kafkaConsumer, "topic", 'websocket-event-ID')
const kafkaSocksSubject = new Subject(io, 'websocket-namespace-ID')

I get this error:

image

I am day to day, not working with JS or typescript so I am a bit confused here?

I tried to install the type but don't think this exists.

npm i --save-dev @types/kafka-socks 
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2fkafka-socks - Not found
npm ERR! 404 
npm ERR! 404  '@types/kafka-socks@*' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/simon/.npm/_logs/2021-12-13T00_43_05_792Z-debug.log

Is this something you have seen before?

@allisonIsCoding
Copy link
Collaborator

allisonIsCoding commented Jan 14, 2022

Apologies for the delayed reply here - to test, can you try requiring the module rather than importing it? i.e. const { Confluent, Consumer, Subject } = require('kafka-socks');

While I wasn't able to reproduce the issue, this might solve your block!

@allisonIsCoding allisonIsCoding self-assigned this Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants