6
votes

I did a fresh installation of Ubuntu and after installing Yii2 etc I can't seem to be able to run codecept anymore.

I'm using Yii2. I required the latest codecept version in composer.json which is working fine. But I can't seem to find a way to get codeception running again.

I've been looking through all the guides but none of them have anything other then just to composer require or add it to the composer.json. I do have noticed when I wanted to add codecept to my $PATH that I don't have a codecept file in root/vendor/bin/, where I think the $PATH entry should point to.

I have no idea where to go from here. Did I miss some step somewhere maybe? Just to sum things up:

  • codeception (yiisoft/yii2-codeception) is installed.
  • root/vendor/bin/ does not contain anything that points to codeception.
  • command: codecept run unit returns: codecept: Command not found
  • command: (./)vendor/bin/codecept return: "path": no such file or directory.
3
Do you have "config": { "bin-dir": "bin"} set in your composer.json file, because that's the path that codeception uses to install its executable phar file, if not, add it to the composer.json file, and update composer, you should now be able to run bin/codecept run unit. Alternatively, the third command you've tried should've been ./codecept run unit, not codecept run unit, maybe give that a shot. - Elias Van Ootegem
Thanks for the advice. I've already installed codeception by adding it to my composer.json. I've tried ./codecept run unit doesn't work either. That is how I run ./yii commands, but on my pre-installed system that wasn't necassary. - Wijnand

3 Answers

12
votes

codecept: command not found on Ubuntu then you should follow these steps:

sudo composer global require "codeception/codeception=2.1.*" "codeception/specify=*" "codeception/verify=*"

and then run this command:

sudo ln -s ~/.composer/vendor/bin/codecept    /usr/local/bin/codecept

So codecept build and codecept run will work.


If you are using Windows then run this command:
composer global require "codeception/codeception=2.1.*" "codeception/specify=*" "codeception/verify=*"

Add this line into your path:

~\AppData\Roaming\Composer\vendor\bin
2
votes

You should add composer global packages binaries to your PATH.

For local development I'm using Vagrant, here is example for it:

export PATH=$PATH:/home/vagrant/.composer/vendor/bin
-1
votes

If you have some like this error:

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

Just run:

$ rm composer.lock 
$ composer update