Yarn install fails with 'EEXIST: file already exists, symlink ...'

Hi community,

during setup my first VSF-Next project, I am facing the problem that a yarn install ist not working after the initial ‘yarn install’.

Steps to repeat:

error An unexpected error occurred: "EEXIST: file already exists, symlink '../../../../core/nuxt-theme-module' -> '/mnt/d/commercetools/DCE/vue-storefront_NEXT/packages/commercetools/theme/node_modules/@vue-storefront/nuxt-theme'".

The same happens when I use yarn add <dependency> within the desired package (commercetools-theme) directly.

In fact, yarn install only works after a clean cloning of the repository.

What is going wrong here? I am using Ubuntu within Windows Subsystem for Linux (WSL).

Thanks in advance,

Alexander

Hello,
when you are adding a new dependency please add it directly in the exact repo e.g. packages/commercetools/theme. Then you might need to run:

  1. npx lerna clean (in root dir)
  2. yarn (in root dir)
1 Like

Thanks for the response. I tried it, it worked! :slight_smile:

Do you know, why is it required to delete all node_modules directories first with ‘npx lerna clean’ before you can install a new package without errors? Is this a lerna/yarn bug?

Thanks and kind regards,

Alexander

Hard to say, I believe there still might be something wrong with our configuration. Anyway, installing dependencies will be much faster when one of our developers (Filip Sobol) will merge his now PR which gets rid of nohoist monorepo setting

It’s seems like a yarn bug and we already have a bug raised for this issue here:

Adding to what @Fifciuu has already said, PR linked below will not only make dependency installation much faster, it will also fix this issue, so there will be no need to reinstall dependencies.

1 Like