亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Ben Awad 視頻教程問題與 npx mikro-orm 遷移:創建

Ben Awad 視頻教程問題與 npx mikro-orm 遷移:創建

蕭十郎 2023-04-27 17:25:41
我正在逐步按照教程進行操作,當我到達 run 的部分時npx mikro-orm migration:create,出現此錯誤TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Received null    at prepareSecretKey (internal/crypto/keys.js:322:11)    at new Hmac (internal/crypto/hash.js:113:9)    at Object.createHmac (crypto.js:147:10)    at createHMAC (C:\lireddit-server\node_modules\pg\lib\sasl.js:133:17)    at Hi (C:\lireddit-server\node_modules\pg\lib\sasl.js:137:13)    at Object.continueSession (C:\lireddit-server\node_modules\pg\lib\sasl.js:32:24)    at Client._handleAuthSASLContinue (C:\lireddit-server\node_modules\pg\lib\client.js:248:10)    at Connection.emit (events.js:314:20)    at Connection.EventEmitter.emit (domain.js:483:12)    at C:\lireddit-server\node_modules\pg\lib\connection.js:109:12    at Parser.parse (C:\lireddit-server\node_modules\pg-protocol\src\parser.ts:102:9)    at Socket.<anonymous> (C:\lireddit-server\node_modules\pg-protocol\src\index.ts:7:48)    at Socket.emit (events.js:314:20)    at Socket.EventEmitter.emit (domain.js:483:12)    at addChunk (_stream_readable.js:298:12)    at readableAddChunk (_stream_readable.js:273:9)```I can't find any solution on google, and the tut doesn't point out how to login to postgresql on the app
查看完整描述

2 回答

?
qq_花開花謝_0

TA貢獻1835條經驗 獲得超7個贊

您缺少一些配置,很可能user是或password字段。

如果您不提供它們,MikroORM 將為給定的驅動程序選擇默認值,即postgres用戶和空密碼 - 您的 postgres 安裝顯然沒有該用戶的空密碼。

如果你使用 docker 創建 postgres 服務器,你可以這樣讓它接受空 pws:

postgre:
????image:?postgres:12.4
????ports:
??????-?5432:5432
????environment:
??????POSTGRES_HOST_AUTH_METHOD:?trust???<--?here


查看完整回答
反對 回復 2023-04-27
?
米琪卡哇伊

TA貢獻1998條經驗 獲得超6個贊

似乎您沒有指定password要user在MikroORM.init.


這應該工作


export default {

  entities: [Entity],

  dbName: "yourDatabaseName",

  type: "postgresql",

  user: "yourUserName",

  password: "yourPassword"

} as Parameters<typeof MikroORM.init>[0];


查看完整回答
反對 回復 2023-04-27
  • 2 回答
  • 0 關注
  • 148 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號