Skip to content

Application can't resolve nats dependency #653

@cardiogramx

Description

@cardiogramx

Observed behavior

I installed nats via npm i nats but whenever I run my app, I get the following error

./node_modules/nats/lib/src/mod.js Module not found: Can't resolve 'stream/web' in '/Users/desktop/myapp/node_modules/nats/lib/src'

Expected behavior

private readonly codec = StringCodec();

send = async <TOut, Tin>(subject: string, payload: Tin): Promise<TOut> => {
    const connection: NatsConnection = await connect(this.brokerOptions);
    const result = await connection.request(subject, JSON.stringify(payload), { timeout: 1000 })
        .then((m) => this.codec.decode(m.data))
        .then((data) => <TOut>JSON.parse(data));
    connection.close();
    return result;
};

Server and client version

nats version: "2.21.0"

node version: 16.17.1

npm version: 8.15.0

Host environment

No response

Steps to reproduce

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectSuspected defect such as a bug or regression

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions