franzliedke / studio

A workbench for developing Composer packages.
MIT License
1.14k stars 73 forks source link

Class not found error after update to 0.10.0 #55

Closed boris-glumpler closed 8 years ago

boris-glumpler commented 8 years ago

Been using Studio for a while now and it's worked great. I use it to share packages between 3 different, but connected projects. I just updated from 0.9.5 to 0.10.0 and am getting class not found errors when running composer update. Specifically, it's happening in the post-update-cmd event and the classes not found are service providers. Studio is globally installed and they are all Laravel 5 applications. All workbench packages are 2 levels up from the Laravel roots. When I go back to 0.9.5 it all works again. Got any advice?

RemiCollin commented 8 years ago

I always have the same kind of errors when using laravel. What I usually do is run a composer update --no-scripts for the autoloader to be generated then run a composer update for the scripts. Usually does the trick

franzliedke commented 8 years ago

@shabushabu Did you add the packages to your require block in composer.json? You will have to do that in the new version - sorry that I wasn't clear enough about that...

boris-glumpler commented 8 years ago

Brilliant! That was it. Thanks, @franzliedke. Makes sense when you think about it ;)

trip-somers commented 8 years ago

I am having this problem now as well. (I stayed on 0.9.5 for too long.) @franzliedke, can you explain what you mean by "add the packages to your require block"?

I am trying to load a single package that exists as a git repo.

When I add my package to the require block, composer appears to try to load it from my private repo instead of the path specified in studio.json.

Adding ping for @shabushabu who also solved this. Looking for any help I can get on this.

franzliedke commented 8 years ago

@theTrip73 You need to require it like any other Composer package - Studio will ensure that on your machine it will be symlinked from the directory you "load" using it, instead of from Packagist.

trip-somers commented 8 years ago

So if I require "myvendor/mypackage": "~2.2", composer is going to download and install it from the repository, but it will autoload from the loaded path location?

I'm asking because I tried "myvendor/mypackage": "*", thinking that version number wouldn't matter since I was loading it from a local folder, but composer used my repo instead of the "workbench/mypackage" location.

Is it possible that my situation is different because I'm using my own package server instead of Packagist? Seems like it should work the same since it's a composer plugin.

franzliedke commented 8 years ago

If the package is located in one of the paths listed in studio.json and part of your "require" block in composer.json, then yes it should load.

trip-somers commented 8 years ago

That's how I understand that it should work, but composer appears to be processing the composer.json associated with the specific version that it downloads from my repo rather than the composer.json in my local folder. Is that how it is supposed to work?

I'm very confused because it sure seems like I'm doing everything as described, but Composer keeps downloading the remote package from my repo and processing its composer.json instead of my local one, which is clearly a problem for local development.

trip-somers commented 8 years ago

Can I get explicit instructions on this (added to README or somewhere official)? Nothing that I've tried is loading my local version. It keeps using my remote repository instead.

franzliedke commented 8 years ago

@theTrip73 Sorry for taking so long to get back to you...

I suspect you're basically encountering issue #58 - meaning that Composer has problems resolving from local path repositories when they are currently checked out a tag (i.e. a stable version) if you require a dev-master dependency. Can you try adding some random commit on top of your local library and see whether Studio starts resolving it then?

Besides that, I've also updated the README with some more detailed workflow instructions. Please kindly let me know whether that helps. Any feedback is appreciated - it was about time to make the usage instructions more helpful!

trip-somers commented 8 years ago

@franzliedke Don't want to leave you hanging on this. I've been sidetracked on the project that uses Studio, so I haven't had a chance yet to give this another shot. I've got the alert email marked as new in my Inbox, and I'll be sure to follow-up once I take another crack at it.

trip-somers commented 8 years ago

You nailed it. I probably could have figured out how to make it work from the comments you made at the time, but seeing it laid out in the README made it very easy to understand and implement.

Thanks!