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

CLI cannot bootstrap under PnP #4531

Closed
arcanis opened this issue Aug 31, 2019 · 1 comment
Closed

CLI cannot bootstrap under PnP #4531

arcanis opened this issue Aug 31, 2019 · 1 comment

Comments

@arcanis
Copy link
Contributor

arcanis commented Aug 31, 2019

Version

3.11.0

Environment info

Environment Info:

  System:
    OS: macOS 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
  Binaries:
    Node: 12.3.1 - ~/.nodenv/shims/node
    Yarn: 1.17.2 - ~/.nodenv/shims/yarn
    npm: 6.11.1 - ~/.nodenv/shims/npm
  Browsers:
    Chrome: 76.0.3809.132
    Firefox: Not Found
    Safari: 12.1.1
  npmGlobalPackages:
    @vue/cli: 3.11.0

Steps to reproduce

Note: requires #4530

  • Clone the Yarn 2 repository (https://github.com/yarnpkg/berry)
  • Run yarn build:cli inside it
  • Go to /tmp
  • Run PATH="~/path/to/berry/scripts/bin:$PATH" yarn dlx -p @vue/cli vue create vue-cli-yarn2
  • Go to /tmp/vue-cli-yarn2
  • Check the package.json

What is expected?

The package.json should contain all the information.

What is actually happening?

It only contains the devDependencies to the generators; the generators didn't run.


This is caused by resolveModule failing to find the packages, which is caused by the @vue/cli context not having access to the project dependencies. Since the CLI and the project are in different dependency trees, they cannot be loaded in the same context without creating many ambiguities (since they share the same underlying files, a package file could ambiguously depend on two different versions of a single package depending on the dependency tree they are supposed to be part of).

The fix would be to call the generators from within the project dependencies - for example, CRA does that by adding to the project dependencies a package exporting a binary called react-scripts which, when called, calls its own generator. The global CRA then just have to call the binary (using execa), and everything works.

Ref yarnpkg/berry#368

@alessandrotesoro
Copy link

I'm not sure if this is the same issue I was having just now. The command vue create wasn't working anymore it wouldn't generate anything. I then updated Yarn on my end and now it's working again 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants