microsoft / rushstack

Monorepo for tools developed by the Rush Stack community
https://rushstack.io/
Other
5.85k stars 594 forks source link

[Rush] Rush and Vue3 CLI hello world results in ERROR: Child already exists #2331

Closed raseesink closed 2 years ago

raseesink commented 3 years ago

Is this a feature or a bug?

Please describe the actual behavior. After creating a new project with the vue cli rush gives the error "ERROR: Child already exists" when running rush update --purge

If the issue is a bug, how can we reproduce it? Please provide detailed steps and include a GitHub branch if applicable. Your issue will get resolved faster if you can make it easy to investigate. Reproduction repository: https://github.com/raseesink/issueReproductionRushVueChildAlreadyExists

Clone and run rush update --purge. Tested on a mac with nodejs 12.19.0 and 15.0.1. Version on linked repository is with all the latest versions. initial project created with vue cli version 3. Answers to questions saved in homedir/.vuerc

What is the expected behavior? Install dependencies, create shrinkwrap file. No error.

If this is a bug, please provide the tool version, Node.js version, and OS. Mac Rush 5.35.1 Node 12.19.0 (LTS) and 15.0.1 NPM 7.0.3

iclanton commented 3 years ago

In your repro, Rush is trying to link two versions (5.2.1 and 3.1.1) of fork-ts-checker-webpack-plugin to the same project. This appears to be caused by an alias of fork-ts-checker-webpack-plugin-v5 to fork-ts-checker-webpack-plugin referenced in @vue/cli-plugin-typescript.

You're using a newer version of NPM that Rush has been tested with. Historically, NPM has had more issues than we've been able to deal with, so our support stagnated in version 4. Is there a reason you need to use NPM? I just tried your repo with PNPM version 4.14.4 (the version this repo is using) and, after some tsconfig tweaks, things are building fine.

raseesink commented 3 years ago

We use better-npm-audit which doesn't work without npm: https://www.npmjs.com/package/better-npm-audit. We chose npm as we expected that the more popular library would work better with most other software. But we can try to replace that with pnpm audit.

Our main repo is larger, we tried converting it to pnpm and this had been largely succesfull. So this looks like a viable workaround. The unittest in vue don't seem to work however, we are still trying to fix those.

I created a branch in the repo with the work we have done there to convert it to pnpm

raseesink commented 3 years ago

Turns out the unittest don't even work without rush, so that looks like a vue cli bug.

iclanton commented 3 years ago

We chose npm as we expected that the more popular library would work better with most other software.

From my observations, I think the industry has largely moved from NPM to Yarn. We decided to focus our support on PNPM because it's far more strict than Yarn or NPM, so it will catch issues with dependency specification much more quickly. There are some docs here that provide some more background.

renoirb commented 3 years ago

Did you try this with vite?

I could use Vue very well with Rush and Vite.

Link631 commented 2 years ago

I get the same Error with spfx projects linked to a custom npm library using npm.

rush update ends with error "child already exists".

tkalmar commented 2 years ago

I added log output and the offending package is vue-loader. It is a dependency of vue-cli-service but is required in two versions: "@vue/vue-loader-v15": "npm:vue-loader@^15.9.7" and "vue-loader": "^17.0.0"` Rush seems to choke on the -v15 alias

DawnSouther commented 2 years ago

@tkalmar @raseesink Is there any solution if using npm?

tkalmar commented 2 years ago

@DawnSouther the issue should be fixed for npm also, all you have to do is update your rush version to 5.63.0

DawnSouther commented 2 years ago

@tkalmar Thank you! It's resolved

cqcmdwym commented 2 years ago

@tkalmar @DawnSouther could you share more info, thanks? I still got 'ERROR: Child already exists: mocha' after upgrading to rush 5.63.0.

DawnSouther commented 2 years ago

@cqcmdwym Maybe you can try to modify the version of mocha, I can solve the problem of vue and upgrade to 5.0.0

cqcmdwym commented 2 years ago

Thanks, could you share the snippet(npm alias) of vue in package.json? Thanks.

Reisclef commented 2 years ago

I'm also getting the aforementioned error using NPM on Rush 3.69 when using Docusaurus, which uses an npm alias to redirect react-loadable to its own implementation of @docusarus/react-loadable like this:

dependencies {
    "@docusaurus/react-loadable": "5.5.2",
    .........
    "react-loadable": "npm:@docusaurus/react-loadable@5.5.2",
    .........
}

https://github.com/facebook/docusaurus/blob/v2.0.0-beta.20/packages/docusaurus/package.json