Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Package manifest at '/Package.swift' cannot be accessed (/Package.swift doesn't exist in file system)

Good Day,

I was working on a project and did a build onto my device for some testing and close down the computer for a few days. When I went to open the project back up today Im being met with this error.

"the package manifest at '/Package.swift' cannot be accessed (/Package.swift doesn't exist in file system)"

Package Error

I tried all the recommended solutions I saw here on Stack with no resolution. The strange thing is that I didn't touch anything and did a build before closing it down so I'm downright stumped into whats going on here.

To help test, I made a totally new project and started to import some packages that I had on my other project. That project works just fine and the files seem to be the same.

Any help on solving this would be appreciated

like image 451
JB Burrows Avatar asked Nov 18 '25 04:11

JB Burrows


1 Answers

For me, this was happening while attempting to checkout a SPM dependency at a version that didn't yet have a Package.swift (i.e. didn't support SPM yet), e.g.:

.package(name: "MyDependency", url: "https://github.com/user/MyDependency.git", .upToNextMajor(from: "1.0.0")),

While only e.g. v2.0.0 had a Package.swift declared.

Solution was to set the version to a version that had a Package.swift, e.g.:

.package(name: "MyDependency", url: "https://github.com/user/MyDependency.git", .upToNextMajor(from: "2.0.0")),
like image 147
Roger Oba Avatar answered Nov 19 '25 22:11

Roger Oba