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