我试图将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
答案 0 :(得分:2)
sails-auth库是一个第三方模块,几年内未进行更新,因此它可能与较新版本的Sails(1.0及更高版本)不兼容。
在出现故障的地方,它正在尝试使用deprecated as of Sails 1.0的sails.getBaseUrl
。 (而且似乎大写开头是这样的:它使用getBaseurl
而不是使用大写“ U”的getBaseUrl
,因此即使在较旧的Sails版本中也可能无法使用。)
对于Sails 1.0和更高版本中的内置身份验证,请尝试使用以下内容生成新应用:sails new foo --caviar
。 (您可以参考使用该模板here构建的示例应用。)