未找到依赖项:./node_modules/vue server renderer/build.dev.js中的模块

cl25kdpy  于 2021-09-13  发布在  Java
关注(0)|答案(0)|浏览(361)

我正在尝试实施ssr,但出现以下错误:

ERROR  Failed to compile with 1 error                                                                         16:11:16

This dependency was not found:

* module in ./node_modules/vue-server-renderer/build.dev.js

To install it, you can run: npm install --save module

在main.js文件中,我有以下代码:

const app = new Vue({
        i18n,
        router: routerInstance,
        render: h => h(App),
    }).$mount('#app')

    const renderer = require('vue-server-renderer').createRenderer({
        template: require('fs').readFileSync('./index.template.html', 'utf-8')
    })

    renderer.renderToString(app, (err, html) => {
        console.log(html) // will be the full page with app content injected.
    })


有什么想法吗?非常感谢。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题