Script codecept handling the __exec_command event returned with error code 255 - laravel

I am very new to unit testing and have been trying to use codeception to do it. So I have followed the following guidelines link
and installed it using composer: composer require "codeception/codeception" --dev, it was successful, but when I tried to set it up using composer exec codecept bootstrap I got the following error:
Script codecept handling the __exec_command event returned with error
code 255
Anyone knows how to fix it?
Just FYI, I have pulled the whole project from a repo that already has the tests/unit folder with previous tests already.
My composer.json file has the following
"require": {
"codeception/robo-paracept": "dev-master",
},
"require-dev": {
"codeception/codeception": "2.6.x-dev",

Apparently the issue was with the php version that I was using. I am using 7.3; using 7.2 solved my problem and the whole thing went smoothly.

Run the command with the -v option to show verbose output.
In my case there where unallowed tabs in my tests/functional.suite.yml file.
I replaced them with 4 spaces and everything was fine.

Related

Class 'Illuminate\Routing\ControllerServiceProvider' not found [duplicate]

I have updated the composer.json file as instructed on the upgrade guide on Laravel 5.2 Documentation and run composer update.
Everything was updated correctly, but composer dumped the error below while generating autoload files.
Class 'Illuminate\Routing\ControllerService Provider' not found in /home/vagrant/Code/homework/vendor/laravel/framework /src/Illuminate/Foundation/ProviderRepository.php on line 146
Make sure you remove Illuminate\Routing\ControllerServiceProvider from your /config/app.php.
https://www.laravel.com/docs/5.2/upgrade (see the "Service Providers" section)
Problem is with your composer.json.It may got corrupted. Make sure
"require": {
"laravel/framework": "5.2.*"
},
exists.Then run composer update.

How to install Laravel Vite?

The Laravel Vite Doc sais to run:
npx apply laravel:vite --ignore-existing
inside your project root to install vite in your laravel project.
When I try to do that in a freshly installed laravel project it shows this:
zsh:1: command not found: laravel:vite
What am I doing wrong?
Using Macos Big Sur with PhpStorm.
That command no longer applies to newly created projects (as of laravel-vite 0.1.27, released a few days ago), and it now results in a different error:
$ npx apply laravel:vite --ignore-existing
[ info ] Applying preset laravel:vite.
[ error ] The preset could not be evaluated.
evalmachine.<anonymous>:13
var preset_default = definePreset({
^
ReferenceError: definePreset is not defined
at evalmachine.<anonymous>:13:22
at Script.runInContext (node:vm:139:12)
at Object.runInContext (node:vm:289:6)
at ModuleImporter.evaluateConfiguration (/Users/tony/src/laravel-vite-demo/example-app/node_modules/apply/dist/Importer/ModuleImporter.js:68:26)
at ModuleImporter.import (/Users/tony/src/laravel-vite-demo/example-app/node_modules/apply/dist/Importer/ModuleImporter.js:17:27)
at PresetApplier.run (/Users/tony/src/laravel-vite-demo/example-app/node_modules/apply/dist/Applier/PresetApplier.js:22:87)
at async CommandLineInterface.apply (/Users/tony/src/laravel-vite-demo/example-app/node_modules/apply/dist/IO/CommandLineInterface.js:57:16)
at async CommandLineInterface.run (/Users/tony/src/laravel-vite-demo/example-app/node_modules/apply/dist/IO/CommandLineInterface.js:54:16)
However, the command shown in the laravel-presets/vite repository (the source repo for the laravel:vite preset) worked for me -- i.e., it augmented the Laravel project with Vite:
# Run this command from root of Laravel project
npx #preset/cli apply --debug laravel:vite
#preset/cli currently suppresses all output (including errors), so the --debug flag above is important. Since the verbose log is difficult to follow, I recommend redirecting the output to a file, and searching it for the word exception.
Tips
To ensure the preset succeeds, you must have php#8.0 (e.g., from Homebrew) and composer installed and available from the command line. Add the paths to those binaries to your PATH environment variable.
The Vite server must be started separately from the PHP server. Run npm run dev in one terminal; and php artisan serve from another.
Vite is now the default frontend asset bundler in laravel which replaces webpack. No additional installations are needed for new projects.
https://laravel-news.com/vite-is-the-default-frontend-asset-bundler-for-laravel-applications

Symfony parse error in output.php when creating project in laravel

Installed laravel 5.6
Have PHP 7.0 installed as well.
When I try
laravel new sample-project
it creates the required files and dependencies but bails with an error below:
PHP Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /home/johndoe/laravel/sample-project/vendor/symfony/console/Output/Output.php on line 40
Have a feeling this might be due to issues with the symfony file but not sure how to go about getting the right version or making a change in Output.php
Trying any other command such as
php artisan list
results in the same error
Composer relevant section denoting laravel 5.6 / php 7.1.3
"require": {
"php": "^7.1.3",
"fideloper/proxy": "~4.0",
"laravel/framework": "5.6.*",
"laravel/tinker": "~1.0"
},
Any help would be appreciated.
EDIT
Based on the answer I had to create a project with laravel version 5.5 which means I had to use
composer create-project laravel/laravel sample-project "5.5.*"
That worked.
Laravel 5.6 requires PHP > 7.1.3
you will need to make sure your server meets the following
requirements:
PHP >= 7.1.3
I ended up having to edit the $PATH in my .bashrc file, because it was picking up an old version of php.
> whereis php
> echo $PATH
I found the correct version of php here: /opt/php71/bin
So now my .bashrc file looks like this:
export PATH=/opt/php71/bin:$PATH
This fixed the error I was getting in composer, AND now php artisan also works!
:-D
PS. The version of php that you're using in the shell may be different from the version used to serve your site. That can be fixed in cpanel's php selector.

Composer fails [UnexpectedValueException]

After installing a new version of a Magento 2 module composer fails on every command. Also the backend of Magento isn't working anymore:
1 exception(s):
Exception #0 (UnexpectedValueException): Package magento/composer's
source key should be specified as {"type": ..., "url": ...,
"reference": ...},
{"type":"git","url":"https:\/\/github.com\/magento\/composer.git","reference":null} given.
Also when using composer -v command via ssh the same error is showing.
When trying to flush the cache via ssh the same error is showing and also an extra error:
Fatal error: Uncaught Error: Class 'Cli' not found in
Does anyone know how to fix this?
Few things you can try:
Try to reinstall composer.
Also you can try running composer clear-cache. Also check for any running composer process and kill then first.
If this is still an issue anyone has I found through much digging that reference cannot be set to null. If a download from source is necessary than I recommend moving up a directory for your url or use a dist instead of source

Cloudstack client installation

I have XAMPP installed on Windows 10. And have successfully installed Composer, Laravel. I can see the basic Laravel project page on my local server.
Just to try things out I also installed yii2. I can see the basic yii2 page also on my local server.
Now I'm trying to install this Generic Cloudstack Client:
https://github.com/PCextreme/cloudstack-client
In XAMPP, under htdocs I have this dir called 'LaravelProjects'.
dir structure
First I made the project with the laravel command:
laravel new PCextreme
Then in PCextreme directory I give the command:
composer require pcextreme/cloudstack-client:~0.1
The composer breaks and shows Conclusion: remove laravel/framework 5.2.41
But in the instructions there is another method to install the package.
When I do that by editting the composer.json in the main Laravel dir. 'LaravelProjects' under xampp/htdocs with these lines:
"require": { "pcextreme/cloudstack-client": "~0.1" }
And then I run the "composer update" command.
I don't get any error.
But as soon as I follow these steps:
Once the package is installed you need to open app/config/app.php and register the required service provider:
`'providers' => [
'PCextreme\CloudstackClient\Providers\LaravelServiceProvider']`
The application breaks.
I can't see the basic page showing 'Laravel 5' on my server anymore.
Instead of that I get a fatal error:
Whoops, looks like something went wrong.
1/1 FatalErrorException in ProviderRepository.php line 146: Class
'PCextreme\CloudstackClient\Providers\LaravelServiceProvider' not found
Further in the instructions, when I give the command below:
php artisan config:publish pcextreme/cloudstack-client
I get this error:
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'PCextreme\CloudstackClient\Providers\LaravelServiceProvider' not found
I have tried out different things that I could find on internet but nothing seems to work in my case.
Could someone kindly help me out with this? Any help is greatly appreciated!
Execute in you project folder command: composer update

Resources