vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
13.07k stars 2.11k forks source link

npx vitepress init does not install the vitepress dependency in package.json #2873

Open glennsc opened 1 year ago

glennsc commented 1 year ago

Describe the bug

Running npx vitepress init and following the default prompts leaves you with a package.json with the vitepress scripts, but no dependency on vitepress itself, so the scripts don't run.

I looked through closed issues and don't see any indication this is by design.

Reproduction

mkdir vp1
cd vp1
npx vitepress init

Take defaults on every prompt. Result:


> vp1 npm run docs:dev

> docs:dev
> vitepress dev

sh: vitepress: command not found

Expected behavior

The vitepress dependency would have been installed.

System Info

System:
    OS: macOS 14.0
    CPU: (8) arm64 Apple M2
    Memory: 1.73 GB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 19.7.0 - ~/Library/Caches/fnm_multishells/49619_1693334605770/bin/node
    Yarn: 1.22.19 - ~/Library/Caches/fnm_multishells/49619_1693334605770/bin/yarn
    npm: 9.6.1 - ~/Library/Caches/fnm_multishells/49619_1693334605770/bin/npm
    pnpm: 8.6.12 - ~/Library/Caches/fnm_multishells/49619_1693334605770/bin/pnpm
  Browsers:
    Chrome: 116.0.5845.140
    Safari: 17.0


### Additional context

_No response_

### Validations

- [X] Check if you're on the [latest VitePress version](https://github.com/vuejs/vitepress/releases/latest).
- [X] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)
- [X] Read the [docs](https://vitepress.dev).
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
brc-dd commented 1 year ago

Currently, this is by design. The docs state: "After installation, start the wizard by running: ...". We can do that probably though. I'll have to check why it was not added earlier 👀

ThisIsMissEm commented 1 month ago

This tripped me up too, as many other npx ... commands for creating projects do include the software used in the dependencies, normally you don't need to do npm add -D ... and npx ... init