config.kit.adapter 应该是一个带有“adapt”方法的对象

Fug*_*ugi 7 javascript svelte sveltekit

我想在我的 Svelte Kit 应用程序中使用 @sveltejs/adapter-static(想把它变成一个 SPA)。我使用 npm i @sveltejs/adapter-static 安装了静态适配器。

svelte.config.cjs 中的代码如下所示

kit: {
    // By default, `npm run build` will create a standard Node app.
    // You can create optimized builds for different platforms by
    // specifying a different adapter
    adapter: adapter({
        fallback: 'app.html'
    }),
Run Code Online (Sandbox Code Playgroud)

当我启动我的应用程序时,npm run dev出现以下错误: config.kit.adapter should be an object with an "adapt" method

我怎样才能解决这个问题?

Tri*_*ter 12

只需使用以下命令安装它:

npm i -D @sveltejs/adapter-static@next
Run Code Online (Sandbox Code Playgroud)

学分转到:https : //github.com/GrygrFlzr

  • 不适合我!还有其他解决方法吗? (3认同)