You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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 🤷♂️
Version
3.11.0
Environment info
Steps to reproduce
Note: requires #4530
yarn build:cli
inside it/tmp
PATH="~/path/to/berry/scripts/bin:$PATH" yarn dlx -p @vue/cli vue create vue-cli-yarn2
/tmp/vue-cli-yarn2
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 (usingexeca
), and everything works.Ref yarnpkg/berry#368
The text was updated successfully, but these errors were encountered: