Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[npx] Cannot find module 'vue' #557

Closed
3 tasks done
hyrious opened this issue Feb 27, 2022 · 3 comments
Closed
3 tasks done

[npx] Cannot find module 'vue' #557

hyrious opened this issue Feb 27, 2022 · 3 comments
Labels
bug: pending triage Maybe a bug, waiting for confirmation

Comments

@hyrious
Copy link

hyrious commented Feb 27, 2022

Describe the bug

I tried to run vitepress through npx without installing it in the local package. And starting from 0.21.4 (I didn't narrow down the version number precisely) npx vitepress build won't work, but npx vitepress dev works fine.

> npx vitepress build docs
vitepress v0.21.4
- building client + server bundles...
✓ building client + server bundles...
- rendering pages...
✖ rendering pages...
build error:
 Error: Cannot find module 'vue'
Require stack:
- /home/runner/work/esbuild-dev/esbuild-dev/docs/.vitepress/.temp/app.js

Full output see the table below:

version behavior log
0.20.9 dev fine, build fine gh action log
0.21.4 ~ 0.22.3 dev fine, build error gh action log

Reproduction

Try this command without installing vitepress:

npx vitepress build docs

Expected behavior

The build command should work.

System Info

  System:
    OS: Windows 10 10.0.19044
    CPU: (4) x64 Intel(R) Core(TM) i5-4200H CPU @ 2.80GHz
    Memory: 6.00 GB / 11.89 GB
  Binaries:
    Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.5.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (98.0.1108.62)
    Internet Explorer: 11.0.19041.1202

Additional context

I noticed #324 has similar situation but the error message differs.

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@hyrious hyrious added the bug: pending triage Maybe a bug, waiting for confirmation label Feb 27, 2022
@brc-dd
Copy link
Member

brc-dd commented Feb 27, 2022

Try npx -p vue -p vitepress vitepress build docs

@hyrious
Copy link
Author

hyrious commented Feb 27, 2022

@brc-dd noluck, same error

@yyx990803
Copy link
Member

This isn't a supported use case because VitePress SSR is executed from a temp build directory in your project. It assumes VitePress itself (and thus Vue) is installed locally.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: pending triage Maybe a bug, waiting for confirmation
Projects
None yet
Development

No branches or pull requests

3 participants