I was running into the same problem, and the issue was that I was running the composer commands in the theme directory when it needs to be run in the root directory of the project.