找不到模块:无法解析“pg-native”

Ekh*_*zac 5 database postgresql node-modules

我正在尝试进行简单的用户登录,并且想将哈希值和盐存储在 PostgreSQL 数据库中。

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
        });
    });
}
Run Code Online (Sandbox Code Playgroud)

但我不断收到此错误;Module not found: Can't resolve 'pg-native'。使用import pg from 'pg'对我来说不起作用,我不知道该怎么办了。