Module not found: Can't resolve 'pg-native'

Viewed 1337

I am trying to make a simple user login, and I want to store the hash and salt in a PostgreSQL database.

const {Client} = require("pg");
const bcrypt = require('bcrypt');


const client = new Client({
   user:"xxxxxxx",
   host:"xxxxxxxxxxxxxxxxxx",
   database:"xxxxxxxxx",
   password:"xxxxxxxxxxxxxxxxxxxxxxx",
   port: 1234
});
   
client.connect()

const saltRounds: number = 10;

const newUserHash = (username: String, password: String) => {
    bcrypt.genSalt(saltRounds, function(err: Error, salt: String) {
        bcrypt.hash(password, salt, function(err: Error, hash: String) {
            //send it to database
        });
    });
}

But I keep getting this error; Module not found: Can't resolve 'pg-native'. Using import pg from 'pg' has not worked for me and I don't know what to do anymore.

0 Answers
Related