Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues when installing a composer-project from scratch #3

Open
deviationist opened this issue Dec 23, 2017 · 2 comments
Open

Issues when installing a composer-project from scratch #3

deviationist opened this issue Dec 23, 2017 · 2 comments

Comments

@deviationist
Copy link

deviationist commented Dec 23, 2017

Hello!
I really love this, great work! :)

I have an existing composer-based WP project, where i use composer to install WP and plugins. I really would like to implement composer-plugin-language-update into this project so we can easily manage translations with composer as well.

The project is already initialized – the vendor-folder is in place and so is the WP-folder along with all the plugin-folders.

Following your guide works perfect, but – since the packages are already installed or since there are no updates available at the moment – no languages are installed. So to install languages i need to reinstall WP and each plugin.

To avoid doing this manual process, i thought it would be better to trigger a complete re-install by:

  • deleting the plugins folder
  • deleting the WP folder
  • deleting the vendor folder
  • running composer install

When I then run composer install, the "post-package-install"-script runs. Not sure whats causing this, but since the autoload.php is still not generated i get an error which is printed under.
This is how my composer.json looks like: https://pastebin.com/tHhPMF7a

Output when running composer install:

composer install                                                                                                                                                  
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 10 installs, 0 updates, 0 removals
  - Installing composer/installers (v1.4.0): Loading from cache
Class AngryCreative\PostUpdateLanguageUpdate is not autoloadable, can not call post-package-install script
  - Installing johnpbloch/wordpress-core-installer (1.0.0): Loading from cache
Class AngryCreative\PostUpdateLanguageUpdate is not autoloadable, can not call post-package-install script
  - Installing wpackagist-plugin/wordpress-seo (6.0): Loading from cache
Class AngryCreative\PostUpdateLanguageUpdate is not autoloadable, can not call post-package-install script
  - Installing guzzlehttp/promises (v1.3.1): Loading from cache
Class AngryCreative\PostUpdateLanguageUpdate is not autoloadable, can not call post-package-install script
  - Installing psr/http-message (1.0.1): Loading from cache
Class AngryCreative\PostUpdateLanguageUpdate is not autoloadable, can not call post-package-install script
  - Installing guzzlehttp/psr7 (1.4.2): Loading from cache
Class AngryCreative\PostUpdateLanguageUpdate is not autoloadable, can not call post-package-install script
  - Installing guzzlehttp/guzzle (6.3.0): Loading from cache
Class AngryCreative\PostUpdateLanguageUpdate is not autoloadable, can not call post-package-install script
  - Installing angrycreative/composer-plugin-language-update (0.1.2): Cloning c50421a6dd from cache

Warning: Uncaught ErrorException: require(/Volumes/Webserver/sites/wp-site/app/public/vendor/autoload.php): failed to open stream: No such file or directory in /Volumes/Webserver/sites/wp-site/app/public/vendor/Angrycreative/composer-plugin-language-update/src/AngryCreative/PostUpdateLanguageUpdate.php:9
Stack trace:
#0 /Volumes/Webserver/sites/wp-site/app/public/vendor/Angrycreative/composer-plugin-language-update/src/AngryCreative/PostUpdateLanguageUpdate.php(9): Composer\Util\ErrorHandler::handle(2, 'require(/Volume...', '/Volumes/Webser...', 9, Array)
#1 /Volumes/Webserver/sites/wp-site/app/public/vendor/Angrycreative/composer-plugin-language-update/src/AngryCreative/PostUpdateLanguageUpdate.php(9): require()
#2 phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php(444): include('/Volumes/Webser...')
#3 phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('/Volumes/Webser...')
#4 [internal function]: Composer\Autoload\ClassLoader->loadClass('AngryCreative\\P.. in /Volumes/Webserver/sites/wp-site/app/public/vendor/Angrycreative/composer-plugin-language-update/src/AngryCreative/PostUpdateLanguageUpdate.php on line 9

Fatal error: main(): Failed opening required '/Volumes/Webserver/sites/wp-site/app/public/vendor/autoload.php' (include_path='.:') in /Volumes/Webserver/sites/wp-site/app/public/vendor/Angrycreative/composer-plugin-language-update/src/AngryCreative/PostUpdateLanguageUpdate.php on line 9
@ottok
Copy link

ottok commented Jan 30, 2018

This plugin seems to make certain assumptions regarding the installation layout and file paths. For example https://github.com/Angrycreative/composer-plugin-language-update/blob/master/src/AngryCreative/PostUpdateLanguageUpdate.php#L9

require dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) . '/autoload.php';

Maybe if the plugin developers would document a bit what these assumptions are so users can adapt, or replace them with some more failure resistant code that can find files from correct paths.

@richardsweeney
Copy link
Contributor

Hey! Sorry, I've been really slow to answer here. Yeah, this works for our setup, but obviously not everyone has the same setup. I'll set if I can have a look at a possible solution for this, otherwise PRs are most welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants