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

Bug with self-update #1226

Closed
antonmedv opened this issue May 21, 2017 · 10 comments
Closed

Bug with self-update #1226

antonmedv opened this issue May 21, 2017 · 10 comments
Labels

Comments

@antonmedv
Copy link
Member

Q A
Issue Type Bug
Deployer Version 5.x

Description

Download 5.0.0, run dep self-update.
Update is successful, but there are errors in terminal:

Fatal error: Uncaught Error: Class 'Symfony\Component\Console\Style\SymfonyStyle' not found in phar:///usr/local/bin/dep/src/Deployer.php on line 300

Error: Class 'Symfony\Component\Console\Style\SymfonyStyle' not found in phar:///usr/local/bin/dep/src/Deployer.php on line 300

Steps to reproduce

curl -O https://deployer.org/releases/v5.0.0/deployer.phar
mv deployer.phar /usr/local/bin/dep
chmod +x /usr/local/bin/dep

dep self-update
@xRahul
Copy link

xRahul commented May 21, 2017

I can work this.
Edit: Not getting any error on self update if using-
php deployer.phar self-update

@xRahul
Copy link

xRahul commented May 21, 2017

I'm out of my element. Everything seems to be there- Pharmap, use, proper require of classloader etc. What is causing the issue?

@antonmedv
Copy link
Member Author

I don't know.

This command is ok:

php deployer.phar self-update
Looking for updates...
Update successful!

But in this way:

curl -O https://deployer.org/releases/v5.0.0/deployer.phar
mv deployer.phar /usr/local/bin/dep
chmod +x /usr/local/bin/dep

dep self-update

Got this:

$ dep self-update
Looking for updates...
Update successful!
PHP Warning:  include(phar:///usr/local/bin/dep/vendor/composer/../../src/Console/CommandEvent.php): failed to open stream: phar error: invalid url or non-existent phar "phar:///usr/local/bin/dep/vendor/composer/../../src/Console/CommandEvent.php" in phar:///usr/local/bin/dep/vendor/composer/ClassLoader.php on line 414
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/dep:0
PHP   2. require() /usr/local/bin/dep:4
PHP   3. Deployer\Deployer::run() phar:///usr/local/bin/dep/bin/dep:110
PHP   4. Symfony\Component\Console\Application->run() phar:///usr/local/bin/dep/src/Deployer.php:315
PHP   5. Symfony\Component\Console\Application->doRun() phar:///usr/local/bin/dep/vendor/symfony/console/Application.php:120
PHP   6. Deployer\Console\Application->doRunCommand() phar:///usr/local/bin/dep/vendor/symfony/console/Application.php:189
PHP   7. spl_autoload_call() phar:///usr/local/bin/dep/src/Console/Application.php:140
PHP   8. Composer\Autoload\ClassLoader->loadClass() phar:///usr/local/bin/dep/src/Console/Application.php:140
PHP   9. Composer\Autoload\includeFile() phar:///usr/local/bin/dep/vendor/composer/ClassLoader.php:301

Warning: include(phar:///usr/local/bin/dep/vendor/composer/../../src/Console/CommandEvent.php): failed to open stream: phar error: invalid url or non-existent phar "phar:///usr/local/bin/dep/vendor/composer/../../src/Console/CommandEvent.php" in phar:///usr/local/bin/dep/vendor/composer/ClassLoader.php on line 414

Call Stack:
    0.0021     353968   1. {main}() /usr/local/bin/dep:0
    0.0061     527592   2. require('phar:///usr/local/bin/dep/bin/dep') /usr/local/bin/dep:4
    0.0092     903656   3. Deployer\Deployer::run() phar:///usr/local/bin/dep/bin/dep:110
    0.0186    1995992   4. Symfony\Component\Console\Application->run() phar:///usr/local/bin/dep/src/Deployer.php:315
    0.0257    1996824   5. Symfony\Component\Console\Application->doRun() phar:///usr/local/bin/dep/vendor/symfony/console/Application.php:120
    0.0258    1996824   6. Deployer\Console\Application->doRunCommand() phar:///usr/local/bin/dep/vendor/symfony/console/Application.php:189
    6.9415    2124072   7. spl_autoload_call() phar:///usr/local/bin/dep/src/Console/Application.php:140
    6.9415    2124208   8. Composer\Autoload\ClassLoader->loadClass() phar:///usr/local/bin/dep/src/Console/Application.php:140
    6.9415    2124208   9. Composer\Autoload\includeFile() phar:///usr/local/bin/dep/vendor/composer/ClassLoader.php:301

PHP Warning:  include(): Failed opening 'phar:///usr/local/bin/dep/vendor/composer/../../src/Console/CommandEvent.php' for inclusion (include_path='phar:///usr/local/bin/dep/bin/../:.:') in phar:///usr/local/bin/dep/vendor/composer/ClassLoader.php on line 414
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/dep:0
PHP   2. require() /usr/local/bin/dep:4
PHP   3. Deployer\Deployer::run() phar:///usr/local/bin/dep/bin/dep:110
PHP   4. Symfony\Component\Console\Application->run() phar:///usr/local/bin/dep/src/Deployer.php:315
PHP   5. Symfony\Component\Console\Application->doRun() phar:///usr/local/bin/dep/vendor/symfony/console/Application.php:120
PHP   6. Deployer\Console\Application->doRunCommand() phar:///usr/local/bin/dep/vendor/symfony/console/Application.php:189
PHP   7. spl_autoload_call() phar:///usr/local/bin/dep/src/Console/Application.php:140
PHP   8. Composer\Autoload\ClassLoader->loadClass() phar:///usr/local/bin/dep/src/Console/Application.php:140
PHP   9. Composer\Autoload\includeFile() phar:///usr/local/bin/dep/vendor/composer/ClassLoader.php:301

Warning: include(): Failed opening 'phar:///usr/local/bin/dep/vendor/composer/../../src/Console/CommandEvent.php' for inclusion (include_path='phar:///usr/local/bin/dep/bin/../:.:') in phar:///usr/local/bin/dep/vendor/composer/ClassLoader.php on line 414

Call Stack:
    0.0021     353968   1. {main}() /usr/local/bin/dep:0
    0.0061     527592   2. require('phar:///usr/local/bin/dep/bin/dep') /usr/local/bin/dep:4
    0.0092     903656   3. Deployer\Deployer::run() phar:///usr/local/bin/dep/bin/dep:110
    0.0186    1995992   4. Symfony\Component\Console\Application->run() phar:///usr/local/bin/dep/src/Deployer.php:315
    0.0257    1996824   5. Symfony\Component\Console\Application->doRun() phar:///usr/local/bin/dep/vendor/symfony/console/Application.php:120
    0.0258    1996824   6. Deployer\Console\Application->doRunCommand() phar:///usr/local/bin/dep/vendor/symfony/console/Application.php:189
    6.9415    2124072   7. spl_autoload_call() phar:///usr/local/bin/dep/src/Console/Application.php:140
    6.9415    2124208   8. Composer\Autoload\ClassLoader->loadClass() phar:///usr/local/bin/dep/src/Console/Application.php:140
    6.9415    2124208   9. Composer\Autoload\includeFile() phar:///usr/local/bin/dep/vendor/composer/ClassLoader.php:301

PHP Warning:  include(phar:///usr/local/bin/dep/vendor/composer/../symfony/console/Style/SymfonyStyle.php): failed to open stream: phar error: invalid url or non-existent phar "phar:///usr/local/bin/dep/vendor/composer/../symfony/console/Style/SymfonyStyle.php" in phar:///usr/local/bin/dep/vendor/composer/ClassLoader.php on line 414
PHP Stack trace:
PHP   1. Deployer\Deployer::Deployer\{closure}() phar:///usr/local/bin/dep/src/Deployer.php:0
PHP   2. spl_autoload_call() phar:///usr/local/bin/dep/src/Deployer.php:300
PHP   3. Composer\Autoload\ClassLoader->loadClass() phar:///usr/local/bin/dep/src/Deployer.php:300
PHP   4. Composer\Autoload\includeFile() phar:///usr/local/bin/dep/vendor/composer/ClassLoader.php:301

Warning: include(phar:///usr/local/bin/dep/vendor/composer/../symfony/console/Style/SymfonyStyle.php): failed to open stream: phar error: invalid url or non-existent phar "phar:///usr/local/bin/dep/vendor/composer/../symfony/console/Style/SymfonyStyle.php" in phar:///usr/local/bin/dep/vendor/composer/ClassLoader.php on line 414

Call Stack:
    6.9440    2116720   1. Deployer\Deployer::Deployer\{closure}() phar:///usr/local/bin/dep/src/Deployer.php:0
    6.9440    2116720   2. spl_autoload_call() phar:///usr/local/bin/dep/src/Deployer.php:300
    6.9440    2116880   3. Composer\Autoload\ClassLoader->loadClass() phar:///usr/local/bin/dep/src/Deployer.php:300
    6.9440    2116880   4. Composer\Autoload\includeFile() phar:///usr/local/bin/dep/vendor/composer/ClassLoader.php:301

PHP Warning:  include(): Failed opening 'phar:///usr/local/bin/dep/vendor/composer/../symfony/console/Style/SymfonyStyle.php' for inclusion (include_path='phar:///usr/local/bin/dep/bin/../:.:') in phar:///usr/local/bin/dep/vendor/composer/ClassLoader.php on line 414
PHP Stack trace:
PHP   1. Deployer\Deployer::Deployer\{closure}() phar:///usr/local/bin/dep/src/Deployer.php:0
PHP   2. spl_autoload_call() phar:///usr/local/bin/dep/src/Deployer.php:300
PHP   3. Composer\Autoload\ClassLoader->loadClass() phar:///usr/local/bin/dep/src/Deployer.php:300
PHP   4. Composer\Autoload\includeFile() phar:///usr/local/bin/dep/vendor/composer/ClassLoader.php:301

Warning: include(): Failed opening 'phar:///usr/local/bin/dep/vendor/composer/../symfony/console/Style/SymfonyStyle.php' for inclusion (include_path='phar:///usr/local/bin/dep/bin/../:.:') in phar:///usr/local/bin/dep/vendor/composer/ClassLoader.php on line 414

Call Stack:
    6.9440    2116720   1. Deployer\Deployer::Deployer\{closure}() phar:///usr/local/bin/dep/src/Deployer.php:0
    6.9440    2116720   2. spl_autoload_call() phar:///usr/local/bin/dep/src/Deployer.php:300
    6.9440    2116880   3. Composer\Autoload\ClassLoader->loadClass() phar:///usr/local/bin/dep/src/Deployer.php:300
    6.9440    2116880   4. Composer\Autoload\includeFile() phar:///usr/local/bin/dep/vendor/composer/ClassLoader.php:301

PHP Fatal error:  Uncaught Error: Class 'Symfony\Component\Console\Style\SymfonyStyle' not found in phar:///usr/local/bin/dep/src/Deployer.php:300
Stack trace:
#0 [internal function]: Deployer\Deployer::Deployer\{closure}(Object(Error))
#1 {main}
  thrown in phar:///usr/local/bin/dep/src/Deployer.php on line 300

Fatal error: Uncaught Error: Class 'Symfony\Component\Console\Style\SymfonyStyle' not found in phar:///usr/local/bin/dep/src/Deployer.php on line 300

Error: Class 'Symfony\Component\Console\Style\SymfonyStyle' not found in phar:///usr/local/bin/dep/src/Deployer.php on line 300

Call Stack:
    6.9440    2116720   1. Deployer\Deployer::Deployer\{closure}() phar:///usr/local/bin/dep/src/Deployer.php:0

@xRahul
Copy link

xRahul commented May 21, 2017

I will take checkout of 5.0.0 version and try there. How do I build the phar though?

@antonmedv
Copy link
Member Author

bin/build

@xRahul
Copy link

xRahul commented May 23, 2017

Tested by building locally. Somehow, The code fails to include some php files with Deployer namespace.
Error-

Class 'Deployer\Console\CommandEvent' not found
phar:///usr/local/bin/dep/src/Console/Application.php
Line 140

after manually including that file at the top, getting same error for a new class-
Class 'Deployer\Host\HostCollection' not found

I think this is some autoloader related issue.

@antonmedv
Copy link
Member Author

really strange. work's well for me.

@xRahul
Copy link

xRahul commented May 24, 2017

I haven't been able to find anything related to this online too. Any solutions I've found, have already been implemented in the codebase. It needs in-depth understanding of Phars and composer autoloading. So, you should remove the "good for beginner" tag I think.

@antonmedv
Copy link
Member Author

Nailed it! Tricky one.

@jimmyadaro
Copy link

Just in case someone has this issue when executing a globally phar-installed Deployer, and you get this error on using $ dep or $ /usr/local/bin/dep:

Parse error: parse error in phar:///usr/local/bin/dep/bin/dep on line 109

You can create an alias to that file; open your .bash or .zsh profile file (usually inside your ~ folder) and point your PHP file (wherever it is in) to /usr/local/bin/dep like so:

# Use Deployer
alias dep='/Applications/XAMPP/xamppfiles/bin/php /usr/local/bin/dep'

Then just source that file and run:

$ dep

You should see something like this:

Deployer X.Y.Z

Usage:
  command [options] [arguments]

Options:
// ...

I don't have the time now to understand why that happens, but there's just a little tricky move to (somehow) make it work.

Also thanks for this great software :)

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

No branches or pull requests

3 participants