我尝试使用身份验证创建sailsjs webapi。
我的api工作正常,直到我添加用于身份验证的包而不更改任何其他内容。
运行此命令后,我的api出现500内部服务器错误:
sudo npm install sails-permissions sails-auth@2.1.1 lodash sails-mongo --save
我有以下错误:
error: Sending 500 ("Server Error") response:
TypeError: Cannot read property 'initialize' of undefined
at module.exports (/home/rick/Documents/apexBackend/node_modules/sails-auth/dist/api/policies/passport.js:35:11)
at routeTargetFnWrapper (/usr/lib/node_modules/sails/lib/router/bind.js:179:5)
at callbacks (/usr/lib/node_modules/sails/node_modules/express/lib/router/index.js:164:37)
at param (/usr/lib/node_modules/sails/node_modules/express/lib/router/index.js:138:11)
at pass (/usr/lib/node_modules/sails/node_modules/express/lib/router/index.js:145:5)
at nextRoute (/usr/lib/node_modules/sails/node_modules/express/lib/router/index.js:100:7)
at callbacks (/usr/lib/node_modules/sails/node_modules/express/lib/router/index.js:167:11)
at /usr/lib/node_modules/sails/lib/router/bind.js:187:7
at module.exports (/home/rick/Documents/apexBackend/node_modules/sails-auth/dist/api/policies/basicAuth.js:13:12)
at routeTargetFnWrapper (/usr/lib/node_modules/sails/lib/router/bind.js:179:5)
at callbacks (/usr/lib/node_modules/sails/node_modules/express/lib/router/index.js:164:37)
at param (/usr/lib/node_modules/sails/node_modules/express/lib/router/index.js:138:11)
at pass (/usr/lib/node_modules/sails/node_modules/express/lib/router/index.js:145:5)
at nextRoute (/usr/lib/node_modules/sails/node_modules/express/lib/router/index.js:100:7)
at callbacks (/usr/lib/node_modules/sails/node_modules/express/lib/router/index.js:167:11)
at /usr/lib/node_modules/sails/lib/router/bind.js:187:7 [TypeError: Cannot read property 'initialize' of undefined]
这些是我的依赖项:
"ejs": "~0.8.4",
"grunt": "0.4.2",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-coffee": "~0.10.1",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-cssmin": "~0.9.0",
"grunt-contrib-jst": "~0.6.0",
"grunt-contrib-less": "0.11.1",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-sails-linker": "~0.9.5",
"grunt-sync": "~0.0.4",
"include-all": "~0.1.3",
"lodash": "^3.10.1",
"rc": "~0.5.0",
"sails": "~0.11.3",
"sails-auth": "^2.1.1",
"sails-disk": "~0.10.0",
"sails-mongo": "^0.11.5",
"sails-permissions": "^2.1.11"
答案 0 :(得分:0)
使用此命令修复它:
sudo npm install git://github.com/balderdashy/sails.git#master -g
最新版本的帆再次发挥作用。