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

Could not open input file: vendor/bin/run.php #87

Open
lsv opened this issue Dec 8, 2017 · 4 comments
Open

Could not open input file: vendor/bin/run.php #87

lsv opened this issue Dec 8, 2017 · 4 comments

Comments

@lsv
Copy link

lsv commented Dec 8, 2017

Installed with

composer require phpcheckstyle/phpcheckstyle --dev

Installed version V0.14.7

Running vendor/bin/phpcheckstyle or vendor/bin/phpcheckstyle -h

Recieved: Could not open input file: vendor/bin/run.php

Changed version to dev-master - using commit 12794c0

Same error

@tchule
Copy link
Contributor

tchule commented Dec 11, 2017

Hi,

I will have a look as soon as I can.

@tchule
Copy link
Contributor

tchule commented Dec 11, 2017

OK, there might be a problem with the Composer post-install script.

When I run composer require phpcheckstyle/phpcheckstyle --dev in a VM, I get a script that is created by composer in /vendor/bin that looks like this :

#!/usr/bin/env sh

dir=$(d=${0%[/\\]*}; cd "$d" > /dev/null; cd '../phpcheckstyle/phpcheckstyle' && pwd)

# See if we are running in Cygwin by checking for cygpath program
if command -v 'cygpath' >/dev/null 2>&1; then
        # Cygwin paths start with /cygdrive/ which will break windows PHP,
        # so we need to translate the dir path to windows format. However
        # we could be using cygwin PHP which does not require this, so we
        # test if the path to PHP starts with /cygdrive/ rather than /usr/bin
        if [[ $(which php) == /cygdrive/* ]]; then
                dir=$(cygpath -m "$dir");
        fi
fi

dir=$(echo $dir | sed 's/ /\ /g')
"${dir}/phpcheckstyle" "$@"

And it works on my debian VM.

But the post-install script that I have listed looks like that :

BASEDIR=$(dirname "$0")

php $BASEDIR/../../run.php

And I was missing the ../.., which could have caused the error you describe.

What is your OS ? Can you tell me what does the /vendor/bin/phpcheckstyle script looks like after install ?

I'm not a specialist in Composer config.

Otherwise, you can always call directly the run.php file.

@automatix
Copy link

automatix commented Apr 28, 2020

Hello!

Just got the issue in a project:

$ vendor/bin/phpcheckstyle --src ./module ...
Could not open input file: vendor/bin/run.php

The file .../vendor/bin/phpcheckstyle looks like this:

BASEDIR=$(dirname "$0")

php $BASEDIR/run.php "$@"

The file run.php is there:

$ find ./ -name "run.php"
./vendor/phpcheckstyle/phpcheckstyle/run.php

Workaround:

$ vendor/phpcheckstyle/phpcheckstyle/phpcheckstyle --src ./module ...

@IGNBPesty
Copy link
Contributor

Hello ! Thanks for the workaround ^^

I'll check if I can do something in my box.

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

4 participants