无法将 sails-auth 库集成到 sails 项目中

Unable to integrate sails-auth library in sails project

我正在尝试将 sails-auth 库添加到我的 sails 应用程序中。安装后 运行 sails lift 我返回此错误

debug: hookPath: /home/egwuenu/Desktop/shopper/server/node_modules/sails-auth/dist/api/hooks/auth
debug: marlinspike (auth): loading config from /home/egwuenu/Desktop/shopper/server/node_modules/sails-auth/dist/configdebug: marlinspike (auth): loading Services from /home/egwuenu/Desktop/shopper/server/node_modules/sails-auth/dist/api/services...
debug: marlinspike (auth): loading Models...debug: marlinspike (auth): loading Controllers...
debug: marlinspike (auth): loading Policies...error:
error: TypeError: sails.getBaseurl is not a function

sails-auth 库是几年未更新的第 3 方模块,因此它可能与较新版本的 Sails(1.0 及更高版本)不兼容。 在失败的地方,它试图使用 sails.getBaseUrl,即 deprecated as of Sails 1.0。 (而且看起来大写开头是关闭的:它使用 getBaseurl 而不是带有大写字母 "U" 的 getBaseUrl,因此它可能无法使用旧版本的 Sails。)

对于 Sails 1.0 及更高版本中的内置身份验证,请尝试生成一个新应用程序:sails new foo --caviar。 (您可以参考使用该模板构建的示例应用 here。)