For me this problem was fixed when I took out a dependency in my Package.swift file. I used vim to do it, so I'm not sure if it was just editing the file that fixed the issue or the actual dependency was the problem.
Maybe try removing some dependencies in your project, and if that doesn't solve it then editing a file in the project through a different editor and saving it might fix the issue.