slidevjs / slidev

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

Exception on project init #1659

Closed Chiogros closed 5 months ago

Chiogros commented 5 months ago

Describe the bug Getting started instructions fail.

npm init slidev@latest and manual installation both lead to Vite exception:

5:13:29 PM [vite] Pre-transform error: Failed to parse source for import analysis because the content contains invalid JS syntax. If you are using JSX, make sure to name the file with the .jsx or .tsx extension.
5:13:29 PM [vite] Pre-transform error: Failed to parse source for import analysis because the content contains invalid JS syntax. If you are using JSX, make sure to name the file with the .jsx or .tsx extension. (x2)
5:13:29 PM [vite] Internal server error: Failed to parse source for import analysis because the content contains invalid JS syntax. If you are using JSX, make sure to name the file with the .jsx or .tsx extension.
  Plugin: vite:import-analysis
  File: /@slidev/slides:2:129
  1  |  import { shallowRef } from 'vue'
  2  |  import * as __layout__error from '/home/user/IT/slidev/node_modules/@slidev/client/layouts/error.vue'
     |                                                                                                                                  ^
  3  |  import { meta as f1 } from '/@slidev/slides/1.frontmatter'
  4  |  const data = [
      at formatError (file:///home/user/IT/slidev/node_modules/vite/dist/node/chunks/dep-DEPSZ3SS.js:52009:46)
      at TransformContext.error (file:///home/user/IT/slidev/node_modules/vite/dist/node/chunks/dep-DEPSZ3SS.js:52003:19)
      at TransformContext.transform (file:///home/user/IT/slidev/node_modules/vite/dist/node/chunks/dep-DEPSZ3SS.js:67247:22)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Object.transform (file:///home/user/IT/slidev/node_modules/vite/dist/node/chunks/dep-DEPSZ3SS.js:52318:30)
      at async loadAndTransform (file:///home/user/IT/slidev/node_modules/vite/dist/node/chunks/dep-DEPSZ3SS.js:55073:29)
      at async viteTransformMiddleware (file:///home/user/IT/slidev/node_modules/vite/dist/node/chunks/dep-DEPSZ3SS.js:64920:32)

NB: I just discovered Slidev, hence it never worked for me before.

To Reproduce

  1. Follow the Starter template or the Install Manually installation instructions
  2. The browser automatically open http://localhost:3030, with a blank page
  3. Read the CLI logs

Desktop (please complete the following information):

KermanX commented 5 months ago

It seems that there is a ' character in the path where you init the Slidev project. This is currently not supported.

Of course, Slidev can fix this occurrence of the "' in path" issue, but it can't be guaranteed everything will work well with a ' in the path. Please move the project to a directory without ' in the path.