slidevjs / slidev

Presentation Slides for Developers
https://sli.dev
MIT License
32.82k stars 1.33k forks source link

Cannot find package 'vue-template-compiler' #1871

Closed cander0815 closed 2 weeks ago

cander0815 commented 2 weeks ago

Hello everyone, I tried to create a project using the command npm init slidev@latest. After running npm install, when I executed npm run dev, I encountered an error in the console:

[vite] Pre-transform error: Cannot find package 'vue-template-compiler' imported from dir/slidev/node_modules/local-pkg/dist/index.mjs.

How should I go about solving this error?

If you need further assistance or more details about the error, feel free to ask.

Slidev: v0.49.29 nodejs: v20.11.0 os: darwin arm64 m1

cander0815 commented 2 weeks ago

I've already resolved the issue. To specify the required Vue version for icons, which is Vue 3 in this case, you can create a vite.config.ts file with the following code:

import { defineConfig } from 'vite'
export default defineConfig({
  slidev: {
    icons: {
      compiler: 'vue3'
    }
  },
})