Skip to content

Solved: Standalone React Project – The directory {directory} contains files that could conflict.

I recently came across this tutorial on the new standalone javascript projects in Visual Studio 2022 via this blog post courtesy of Scott Hanselman. I was excited with the prospect of having standalone javascript projects inside of Visual Studio. Unfortunately I couldn’t move past the first step of creating the project as I was getting the below error in the npm command line window:

The “The directory {directory} contains files that could conflict.” error in npm.

It turns out that the issue is being caused by the solution being placed in the same directory as the project file. In my case, the new project screen defaulted to include the solutiona and project in the same directory causing this issue. All you need to do is make sure the the “Place solution and project in the same directory” tick box is unticked as per the below screenshot:

Configure your new project screen in Visual Studio 2022

I don’t quite understand why Microsoft are providing this option if it causes the project to be created, however, I’m glad that I can now get started with testing these new project types.

Published inSoftware DevelopmentTroubleshooting

4 Comments

  1. Working at Walmart Working at Walmart

    Thx

  2. Chris Chris

    Thank you

  3. frusteratedlittleboy frusteratedlittleboy

    im glad this worked for everyone except me i get the same error message even if i dont check the box theres no way to get rid of it

  4. whoiscall whoiscall

    Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *