think-html-cache报错Error: adapter `adapter_store_base` not found
发布于 作者 livisky 425 次浏览 来自 问答

先上问题

 Error: adapter `adapter_store_base` not found
    at Function.Adapter.get (F:\workspace\web\trunk\market_v2\node_modules\thinkjs\src\core\think_adapter.js:67:9)
    at Object.Adapter (F:\workspace\web\trunk\market_v2\node_modules\thinkjs\src\core\think_adapter.js:37:22)
    at _default.run$ (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\lib\index.js:69:25)
    at tryCatch (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at invoke (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\babel-runtime\regenerator\runtime.js:136:37)
    at enqueueResult (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\babel-runtime\regenerator\runtime.js:185:17)
    at new Promise (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\core-js\library\modules\es6.promise.js:201:7)
    at AsyncIterator.enqueue (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\babel-runtime\regenerator\runtime.js:184:12)
    at AsyncIterator.prototype.(anonymous function) [as next] (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at Object.runtime.async (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\babel-runtime\regenerator\runtime.js:209:12)
    at _default.run (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\lib\index.js:37:32)
    at Function.Middleware.exec (F:\workspace\web\trunk\market_v2\node_modules\thinkjs\src\core\think_middleware.js:80:34)
    at _execItemMiddleware (F:\workspace\web\trunk\market_v2\node_modules\thinkjs\src\core\think_hook.js:92:27)
    at Function.Hook.exec (F:\workspace\web\trunk\market_v2\node_modules\thinkjs\src\core\think_hook.js:108:10)

代码实现和github上的差不多

'use strict';
/**
 * template config
 */
export default {
    on: true, //use html_cache
    type: 'base', //cache content store type
    timeout: 0,
    callback: function(key) {
        return think.md5(key);
    },
    rules: {
        'sites/index/index': ['index/{page}']
    },
    //adapter config
    adapter: {
        file: {
            path: think.RUNTIME_PATH + '/html_cache' //when type is file, set cache path
        }
    }
};

配置

	logic_before: ['prepend', 'html_cache'],
	view_after: ['append', 'html_cache']
	
think.middleware("html_cache", htmlCache);

求解