vuepress / core

Vue-Powered Static Site Generator
https://vuepress.vuejs.org
MIT License
2.17k stars 922 forks source link

[Bug report] Cannot get it work on yarn 2 #21

Closed Mister-Hope closed 3 years ago

Mister-Hope commented 3 years ago

Bug report

Description

command not found: vuepress
终端进程“/bin/bash '-c', 'yarn run dev'”已终止,退出代码: 127。

Steps to reproduce

Expected behavior

Screenshots

Environment info

# Paste output of `vuepress info` here
# Unable to do so, command not found, but I am do using the latest alpha13
meteorlxy commented 3 years ago

Not familiar with yarn v2 yet.

Mister-Hope commented 3 years ago

Meanwhile, I am having some troubles with yarn 1.

When requiring vuepress in a workspace with vuepressV1: image

{
  "name": "demo",
  "scripts": {
    "build": "vuepress build src",
    "clean-serve": "vuepress dev src --no-cache",
    "eject": "vuepress eject-hope src",
    "serve": "vuepress dev src"
  },
  "devDependencies": {
    "vuepress": "1.7.1",
  }
}

But I can not get a bin folder with vuepress 2

image

I both tried on Windows20H2 and WSL2(Ubuntu 20.04) with Node 14.15.3 and Yarn 1.22.5.

I am able to run vuepress in the root folder(the bin folder has vuepress), while the projects inside it are catching issues.

Could you check the package.json for vuepress2?

I think

  "bin": {
    "vuepress": "lib/cli.js"
  },

is required for everything to work fine. @meteorlxy

And if it's an issue, would you mind publishing a new version please?

P.S.: That may be the reason why I cannot found the vuepress command with Yarn2.

meteorlxy commented 3 years ago

The vuepress command is provided by @vuepress/cli.

So the @vuepress/cli that required by vuepress did not take effect when using yarn v2? 🤔

Mister-Hope commented 3 years ago

The vuepress command is provided by @vuepress/cli.

So the @vuepress/cli that required by vuepress did not take effect when using yarn v2? 🤔

It's even not working with yarn V1 in my case. The screenshot I provides are all with v1

Edit: wait, I will try requiring @vuepress/cli and see if it works

Mister-Hope commented 3 years ago

I think we should metion it through docs, that if we are using workspace, we should require @vuepress/cli to get the vuepress command. @meteorlxy Or we should probably make some changes to let the bin generated by the vuepress package and remain the cli file in @vuepress/cli

Mister-Hope commented 3 years ago

I am afraid the yarnV2 issue is related to it too. Yarn 2 only extracts command which is directly required by the project.

meteorlxy commented 3 years ago

We need to confirm if the fix works in next release