3.0.4
Node v10.11.0, Yarn 1.9.4
In an existing project using the package.json field vuePlugins with a Yarn workspace like so...
"vuePlugins": {
"resolveFrom": "someWorkspace"
}
Run the command
vue add @vue/typescript
That the vue plugin is installed and the generator is invoked.
This error
📦 Installing @vue/cli-plugin-typescript...
yarn add v1.9.4
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
error Running this command will add the dependency to the workspace root rather than the workspace itself, which might not be what you want - if you really meant it, make it explicit by running this command again with the -W flag (or --ignore-workspace-root-check).
ERROR command failed: yarn add -D @vue/cli-plugin-typescript
It should be noted that I also get similar errors when manually installing the required dependancies for the Vue-CLI plugin but when using a Yarn Workspace the vue invoke command also fails.
is the vue-cli project itself in a workspace?
It would really be helpful if you could provide a demo repository.
Use .yarnrc
--add.ignore-workspace-root-check true
quick start:
vue add @o3o/packages
Seems to be resolved by @Aircity 's comment, and OP is inactive. Closing for now.
Hi @LinusBorg Sorry this took so long but here is a repo for reproduction. You can just clone this run yarn then run vue add @vue/cli-plugin-typescript
You should get:
📦 Installing @vue/cli-plugin-typescript...
yarn add v1.9.4
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
error Running this command will add the dependency to the workspace root rather than the workspace itself, which might not be what you want - if you really meant it, make it explicit by running this command again with the -W flag (or --ignore-workspace-root-check).
ERROR command failed: yarn add -D @vue/cli-plugin-typescript
Sorry for the wait but thanks for taking a look at this.
I should mention that the .yarnrc fix does work, but I think it should probably be built into VueCLI or at least in the VueCLI docs alongside resolveFrom.
I added .yarnrc in my user folder and my project root, and I still get this issue
C:\Projects\scratch\frontend (develop -> origin)
λ vue add eslint
� Installing @vue/cli-plugin-eslint...
yarn add v1.19.2
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
error Running this command will add the dependency to the workspace root rather than the workspace itself, which might not be what you want - if you really meant it, make it e
xplicit by running this command again with the -W flag (or --ignore-workspace-root-check).
ERROR command failed: yarn add @vue/cli-plugin-eslint -D --registry=https://registry.yarnpkg.com
Adding my two cents in case it helps anyone else out:
I was running into a similar issue. Turns out one of my other packages was using a newer version of typescript which caused @vue/cli-plugin-typescript and typescript to be installed into my package's node_modules instead of the root one. I set both of my packages to use a compatible typescript version and the error went away.
Having a monorepo setup here.
I am using yarn workspaces. vue add eslint ran in the package folder tries to use npm but I want it to use yarn...
vue add eslint in the root folder gives me the same error error Running this command will add the dependency to the workspace.
I don't want to install it into the root, in want to run vue add ... inside the package folder..
Most helpful comment
Hi @LinusBorg Sorry this took so long but here is a repo for reproduction. You can just clone this run
yarnthen runvue add @vue/cli-plugin-typescriptYou should get:
Sorry for the wait but thanks for taking a look at this.
I should mention that the
.yarnrcfix does work, but I think it should probably be built into VueCLI or at least in the VueCLI docs alongsideresolveFrom.