我正在尝试运行Everyauth示例。但是,它显示以下错误
ReferenceError: /Users/tyler/clicker/everyauth/example/views/home.jade:1
> 1| - if (!everyauth.loggedIn)
2| h2 Not Authenticated
3| #register
4| a(href='/register') Register
everyauth is not defined
我已经安装了everyauth。当我运行sudo node server.js来运行该示例时,它会显示应用程序正在运行。但是,当我在localhost:3000访问该站点时,它显示上述错误。
它显示了像everyauth未定义的东西。可能是什么原因?我的意思是每个人都安装了。难道它没有正确导入吗?
答案 0 :(得分:0)
我的猜测是你已经安装了express 3.x,而everyauth示例仍在使用来自express 2.x的app.dynamicHelpers
。安装快递2.x再试一次。
Specificaly this line of code in everyauth调用app.dynamicHelpers
,它是Express 3.x中不存在的快速2.X API。并且this line in the everyauth package.json进一步支持这个示例尚未针对express 3.0更新的概念。
您的短期解决方案是:
npm uninstall express
npm install express@2.5.11
长期来说,需要为express 3.x API更新everyauth示例。