egg 插件加载不进来?
发布于 6 年前 作者 dlyt 2984 次浏览 来自 问答

我修改了这俩个文件配置,并没有this.app.redis啊. 是还需要修改什么其他的么? ${app_root}/config/plugin.js

exports.redis = {
  enable: true,
  package: 'egg-redis',
};

${app_root}/config/config.default.js

'use strict';

module.exports = appInfo => {
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1522295196003_1293';

  // add your config here
  config.middleware = [];
  config.redis = {
    client: {
      port: xx,          // Redis port
      host: '192.168.19.xx',   // Redis host
      password: '',
      db: 0,
    },
  }
  return config;
};

8 回复

npm 安装没

@dlyt 完整的config贴一下

@DerekYeung 贴好 了

@dlyt 看配置应该是没什么问题的 你在什么地方用的redis 提示什么 可以再多贴详细的代码或者上传一个可以运行的demo看看

我打印this.app没有显示redis,实际上this.app.redis是可以调用的…

打印没有很正常。。。

回到顶部