Apostrophecms: TypeError: req.__ns is not a function
Apostrophecms: TypeError: req.__ns is not a function
升级到 v2.105.0 后,我一直遇到这个错误。
TypeError: req.__ns is not a function
at Object.self.getCreateSingletonOptions (/../node_modules/apostrophe/lib/modules/apostrophe-areas/lib/browser.js:26:23)
at Object.self.pushCreateSingleton (/../node_modules/apostrophe/lib/modules/apostrophe-module/index.js:637:26)
at Object.self.pageBeforeSend (/../node_modules/apostrophe/lib/modules/apostrophe-areas/lib/browser.js:18:10)
at Immediate._onImmediate (/../node_modules/apostrophe/index.js:598:20)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
降级到 2.104.0 有帮助,但有解决办法吗?
如果您要覆盖 apostrophe-express 模块,则需要更新 lib/modules/apostrophe-express/index.js。与当前版本相比,您似乎需要在 413 处添加以下行:
self.apos.app.use(self.apos.modules['apostrophe-i18n'].namespacesMiddleware);
假设第412行是这样的:
self.apos.app.use(self.apos.i18n.init);
好吧,至少这对我来说修复了完全相同的错误。
升级到 v2.105.0 后,我一直遇到这个错误。
TypeError: req.__ns is not a function
at Object.self.getCreateSingletonOptions (/../node_modules/apostrophe/lib/modules/apostrophe-areas/lib/browser.js:26:23)
at Object.self.pushCreateSingleton (/../node_modules/apostrophe/lib/modules/apostrophe-module/index.js:637:26)
at Object.self.pageBeforeSend (/../node_modules/apostrophe/lib/modules/apostrophe-areas/lib/browser.js:18:10)
at Immediate._onImmediate (/../node_modules/apostrophe/index.js:598:20)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
降级到 2.104.0 有帮助,但有解决办法吗?
如果您要覆盖 apostrophe-express 模块,则需要更新 lib/modules/apostrophe-express/index.js。与当前版本相比,您似乎需要在 413 处添加以下行:
self.apos.app.use(self.apos.modules['apostrophe-i18n'].namespacesMiddleware);
假设第412行是这样的:
self.apos.app.use(self.apos.i18n.init);
好吧,至少这对我来说修复了完全相同的错误。