yay.md (963B)
1 # yay 2 3 # `yay -Syu` nats-server update issue 4 5 When run into permission denied issue updating `nats-server`, its due to how 6 `go` works: 7 8 ### Quick Solution 9 10 The fastest fix is to manually remove the problematic cache directory with 11 elevated permissions: 12 13 ```bash 14 sudo rm -rf ~/.cache/yay/nats-server 15 ``` 16 17 Then retry building the package: 18 19 ```bash 20 yay -S nats-server 21 ``` 22 23 ### Permanent Solution 24 25 To prevent this from happening in future builds, modify how the package builds 26 Go modules. If you maintain or can edit the `PKGBUILD`, add the `-modcacherw` 27 flag: 28 29 ```bash 30 export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw" 31 ``` 32 33 This flag ensures Go module cache files are created with read-write permissions, 34 allowing yay to clean them up properly after builds. 35 36 37 38 ### Alternative Approach 39 40 If you don't need to preserve the cache, you can clean all yay cache: 41 42 ```bash 43 yay -Sc --aur 44 ``` 45 46 This removes all AUR build directories and untracked files.