slidevjs / slidev

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

Not working on Windows #239

Closed ZhiruiLi closed 3 years ago

ZhiruiLi commented 3 years ago

Describe the bug

When execute npm run dev, even if starting from cleanroom, an error occurs:

TypeError: loadTheme is not a function

To Reproduce Steps to reproduce the behavior:

Just follow the startup guide:

> npm init slidev
Need to install the following packages:
  create-slidev
Ok to proceed? (y) y

  ●■▲
  Slidev Creator  v0.6.11

√ Project name: ... slidev
  Scaffolding project in slidev ...
  Done.

√ Install and start it now? ... yes
√ Choose the agent » npm

added 216 packages, and audited 217 packages in 11s

30 packages are looking for funding
  run `npm fund` for details

2 high severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

> dev
> slidev --open

C:\Users\xxx\projects\slidev\node_modules\@slidev\theme-seriph\setup\shiki.ts:6
      dark: await loadTheme(require.resolve('theme-vitesse/themes/vitesse-dark.json')),
                  ^

TypeError: loadTheme is not a function
    at C:\Users\xxx\projects\slidev\node_modules\@slidev\theme-seriph\setup\shiki.ts:6:19
    at loadSetups (C:\Users\xxx\projects\slidev\node_modules\@slidev\cli\dist\chunk-T2VCIMLG.js:679:28)
    at createMarkdownPlugin (C:\Users\xxx\projects\slidev\node_modules\@slidev\cli\dist\chunk-T2VCIMLG.js:807:32)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ViteSlidevPlugin (C:\Users\xxx\projects\slidev\node_modules\@slidev\cli\dist\chunk-T2VCIMLG.js:962:26)
    at async createServer (C:\Users\xxx\projects\slidev\node_modules\@slidev\cli\dist\chunk-HAH2CPJC.js:10:7)
    at async initServer (C:\Users\xxx\projects\slidev\node_modules\@slidev\cli\dist\cli.js:70:14)
Error: Command failed with exit code 1: npm run dev
    at makeError (C:\Users\xxx\scoop\persist\nodejs\cache\_npx\c00c242a51a5200e\node_modules\execa\lib\error.js:59:11)
    at handlePromise (C:\Users\xxx\scoop\persist\nodejs\cache\_npx\c00c242a51a5200e\node_modules\execa\index.js:114:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async init (C:\Users\xxx\scoop\persist\nodejs\cache\_npx\c00c242a51a5200e\node_modules\create-slidev\index.js:121:5) {
  shortMessage: 'Command failed with exit code 1: npm run dev',
  command: 'npm run dev',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: undefined,
  stderr: undefined,
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

Desktop (please complete the following information):

antfu commented 3 years ago

Have you tried the least version of Slidev?

ZhiruiLi commented 3 years ago

Have you tried the least version of Slidev?

Well, after changing current version to 0.20.0, it works. Hope the latest version can be the default version of npm init slidev.

By the way, the global version of slidev is also not working:

> npm i -g @slidev/cli
> npm i -g @slidev/theme-default
> slidev .\talk.md

  ●■▲
  Slidev  v0.20.0

  theme   @slidev/theme-default
  entry   C:\Users\xxx\yyy\talk.md

  slide show      > http://localhost:3030/
  presenter mode  > http://localhost:3030/presenter
  remote control  > pass --remote to enable

  shortcuts       > restart | open | edit

node:events:371
      throw er; // Unhandled 'error' event
      ^

Error: spawn C:\Users\xxx\scoop\persist\nodejs\bin\node_modules\@slidev\cli\node_modules\esbuild\esbuild.exe ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
    at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\xxx\\scoop\\persist\\nodejs\\bin\\node_modules\\@slidev\\cli\\node_modules\\esbuild\\esbuild.exe',
  path: 'C:\\Users\\xxx\\scoop\\persist\\nodejs\\bin\\node_modules\\@slidev\\cli\\node_modules\\esbuild\\esbuild.exe',
  spawnargs: [ '--service=0.12.8', '--ping' ]
}
antfu commented 3 years ago

Hope the latest version can be the default version of npm init slidev.

It's npm's cache, there is nothing I could do I think. You might need npm init slidev@latest

By the way, the global version of slidev is also not working

No idea on that. Looks like a esbuild issue