vitepress icon indicating copy to clipboard operation
vitepress copied to clipboard

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

Open glennsc opened this issue 2 years ago • 2 comments

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.

glennsc avatar Aug 29 '23 18:08 glennsc

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 👀

brc-dd avatar Aug 29 '23 19:08 brc-dd

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

ThisIsMissEm avatar Sep 16 '24 19:09 ThisIsMissEm