Warning: no saslprep library specified. Passwords will not be sanitized


Warning: no saslprep library specified. Passwords will not be sanitized

在 nodejs 中使用密碼連接 mongodb 時,會報 warning:

Warning: no saslprep library specified. Passwords will not be sanitized
  • 1

在 mongodb 的依賴里 node_modules/mongodb/lib/core/auth/scram.js 發現有以下代碼:

12: let saslprep; 13: try { 14: saslprep = require('saslprep'); 15: } catch (e) { 16: // don't do anything; 17: } ... 264:if (!saslprep) { 265: console.warn('Warning: no saslprep library specified. Passwords will not be sanitized'); 267:} 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

可見如果沒有安裝 saslprep 導致了 warning。所以解決方法就是:

npm install saslprep --save


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM