Buildkit Issue - permissions?
The civibuild command is designed to run as a regular shell user (e.g. john) -- without root permissions. The source code should all be owned by the shell-user, and the data files should be owned by a mix of www-data/apache/www/john. No files should should be owned by root.

The exact errors have varied (depending on the revision and the commands used), so I generally run a search to identify files with errant permissions, e.g.

## Searching for files owned by root (or not by john)
find ~/.npm/ ~/.composer/ ~/.drush/ ~/buildkit/ -user root
find ~/.npm/ ~/.composer/ ~/.drush/ ~/buildkit/ ! -user $(whoami)
find ~/.npm/ ~/.composer/ ~/.drush/ ~/buildkit/ ! -user john -a ! -user www-data

## Changing owner from root to john
find ~/.npm/ ~/.composer/ ~/.drush/ ~/buildkit/ -user root -exec chown john {} \;


Note that this search covers several folders, including:


The caches generated by various build tools (eg npm, composer, drush)
The caches generated by buildkit (eg ~/buildkit/app/tmp)
The actual build (eg ~/buildkit/build/mybuild)


Additionally, if I've recently run amp config to change the permission policy, fixing the permissions on existing files can be pretty fiddly. I find easiest to delete the old build (e.g. civibuild destroy mybuild or rm -rf ~/buildkit/build/mybuild) and then recreate it.