Laravel 5.3 project install : Script php artisan optimize handling the post-update-cmd event returned with error code 255 - php

I am completely new in Laravel Framework and I am trying to install a Laravel project after cloning a project from Github. I followed all the steps mentioned in this post, but couldn't install the project.
It gets stuck every time on the "composer install" step. I get the following error which is same as when I do "composer update":
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 4 installs, 8 updates, 0 removals
- Updating symfony/polyfill-mbstring (v1.3.0 => v1.4.0): Loading from cache
- Updating monolog/monolog (1.22.1 => 1.23.0): Loading from cache
- Updating nikic/php-parser (v3.0.5 => v3.0.6): Loading from cache
- Updating psy/psysh (v0.8.6 => v0.8.9): Loading from cache
- Updating symfony/polyfill-util (v1.3.0 => v1.4.0): Loading from cache
- Updating symfony/polyfill-php56 (v1.3.0 => v1.4.0): Loading from cache
- Updating symfony/event-dispatcher (v3.3.0 => v3.3.4): Loading from cache
- Updating guzzlehttp/guzzle (6.2.3 => 6.3.0): Loading from cache
- Installing composer/ca-bundle (1.0.7): Loading from cache
- Installing bugsnag/bugsnag (v3.5.1): Loading from cache
- Installing bugsnag/bugsnag-psr-logger (v1.1.0): Loading from cache
- Installing bugsnag/bugsnag-laravel (v2.6.0): Loading from cache
Writing lock file
Generating autoload files
Illuminate\Foundation\ComposerScripts::postUpdate
php artisan optimize
Script php artisan optimize handling the post-update-cmd event returned with error code 255
I have no idea what It does but following some suggestions on other posts, I also tried "composer update" and "composer update" followed by "composer dumpautoload". I have no idea what is wrong with it but nothing seems to work at all. I've searched for hours everywhere but couldn't find any solution. Anyone, please help.
Here is my composer.json file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.3.*",
"intervention/image": "2.3.11",
"froala/wysiwyg-editor-php-sdk" : "*",
"chencha/share" : "^5.2",
"laravel/socialite": "^2.0",
"bugsnag/bugsnag-laravel": "^2.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}

remove services.json file from bootstrap/cache folder and then run
composer dump-autoload -o

Related

Error while doing composer install/composer install --ignore-platform-reqs

Problems come one by one, when one problem is solved new problems appear. I'm a novice programmer, I'm very confused with this error.
So when I finished the clone project, then I did
composer install --ignore-platform-reqs
Here an error appears.
At first appears a warning like this
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 122 installs, 0 updates, 0 removals
- Downloading almasaeed2010/adminlte (v3.2.0)
- Downloading laravel/pint (v1.5.0)
0/2 [>---------------------------] 0% - Downloading almasaeed2010/adminlte (v3.2.0)
- Downloading laravel/pint (v1.5.0)
- Downloading almasaeed2010/adminlte (v3.2.0)
//This is a warning// A connection timeout was encountered. If you intend to run Composer without connecting to the internet, run the command again prefixed with COMPOSER_DISABLE_NETWORK=1 to make Composer run in offline mode.
- Downloading laravel/pint (v1.5.0)
- Downloading almasaeed2010/adminlte (v3.2.0)
- Downloading laravel/pint (v1.5.0)
//This is a warning// Failed to download almasaeed2010/adminlte from dist: curl error 28 while downloading https://codeload.github.com/ColorlibHQ/AdminLTE/legacy.zip/bd4d9c72931f1dd28601b6bfb387554a381ad540: Operation timed out after 300000 milliseconds with 2642368 out of 29084334 bytes received
Now trying to download from source
- Syncing almasaeed2010/adminlte (v3.2.0) into cache
1/2 [==============>-------------] 50% //This is a warning// Failed to download laravel/pint from dist: curl error 28 while downloading https://codeload.github.com/laravel/pint/legacy.zip/e0a8cef58b74662f27355be9cdea0e726bbac362: Operation timed out after 602688 milliseconds with 2614603 out of 12086799 bytes received
Now trying to download from source
....
....
....
- Installing almasaeed2010/adminlte (v3.2.0): Cloning bd4d9c7293
//This is a error// Install of almasaeed2010/adminlte failed
- Installing jeroennoten/laravel-adminlte (v3.8.6): Extracting archive
- Installing laravel/pint (v1.5.0): Cloning e0a8cef58b
//This is a warning// Install of laravel/pint failed
- Installing symfony/yaml (v6.2.5): Extracting archive
And at the end an error message appears like this:
120/120 [============================] 100% //This is a error//The following exception is caused by a process timeout Check https://getcomposer.org/doc/06-config.md#process-timeout for details
In Process.php line 1204:
//This is a error// The process "git clone --no-checkout -- https://github.com/ColorlibHQ/AdminLTE.git D:\Desktop\Beasiswa\pencairan\vendor\almasaeed2010\adminlte && cd /D D:\Desktop\Beasiswa\pencairan\vendor\almasaeed2010\adminlte && git remote add composer -- https://github.com/ColorlibHQ/AdminLTE.git && git fetch composer && git remote set-url origin -- https://github.com/ColorlibHQ/AdminLTE.git && git remote set-url composer -- https://github.com/ColorlibHQ/AdminLTE.git" exceeded the timeout of 300 seconds.
My composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.0.2",
"guzzlehttp/guzzle": "^7.2",
"jeroennoten/laravel-adminlte": "^3.8",
"laravel/framework": "^9.19",
"laravel/sanctum": "^3.0",
"laravel/tinker": "^2.7",
"laravel/ui": "^4.2"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.12",
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-update-cmd": [
"#php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}
Help,Where is the fault? And how to fix it. Thankyou!

composer installed.json" does not contain valid JSON

I upgraded laravel 5.4 to laravel 5.5 according to the official documents, and then executed composer update, which returned this error
- Installing theseer/tokenizer (1.2.0): Extracting archive
- Installing sebastian/code-unit-reverse-lookup (1.0.2): Extracting archive
- Installing phpunit/php-code-coverage (5.3.2): Extracting archive
- Installing phpspec/prophecy (v1.10.3): Extracting archive
- Installing phar-io/version (1.0.1): Extracting archive
- Installing phar-io/manifest (1.0.1): Extracting archive
- Installing myclabs/deep-copy (1.10.2): Extracting archive
- Installing phpunit/phpunit (6.5.14): Extracting archive
- Installing predis/predis (v1.1.7): Extracting archive
Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.
Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.
Package mtdowling/cron-expression is abandoned, you should avoid using it. Use dragonmantank/cron-expression instead.
Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
[Seld\JsonLint\ParsingException]
"/home/vagrant/work/exports-api/vendor/composer/installed.json" does not co
ntain valid JSON
Parse error on line 1:
^
Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
this is my composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"predis/predis": "^1.1"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~6.0",
"filp/whoops": "~2.0"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
Then I'll check the file "/home/vagrant/work/exports-api/vendor/composer/installed.json" It's a blank, nothing
Supplementary notes
Before the update, there was something in installed.json, and composer update became blank. Now, the composer operation under this project will return this error
I changed the composer version from 2.0 to 1.0 to solve the problem

Laravel 5.2 Heroku Deployment Failed to install system packages

I am trying to deploy Laravel 5.2 project to heroku but I am getting the following error
-----> PHP app detected
-----> Bootstrapping...
-----> Installing platform packages...
! ERROR: Failed to install system packages.
Your platform requirements (for runtimes and extensions) could
not be resolved to an installable set of dependencies, or a
repository was unreachable.
Full error information from installation attempt:
> Loading repositories with available runtimes and extensions
>
> Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
> Nothing to install or update
> Generating autoload files
Please verify that all requirements for runtime versions in
'composer.lock' are compatible with the list below, and ensure
all required extensions are available for the desired runtimes.
For reference, the following runtimes are currently available:
PHP: 7.1.10, 7.1.9, 7.1.8, 7.1.3, 7.1.2, 7.1.1, 7.0.24,
7.0.23, 7.0.22, 7.0.17, 7.0.16, 7.0.15, 5.6.31, 5.6.30,
5.5.38
HHVM: 3.5.1
For a list of supported runtimes & extensions on Heroku, please
refer to: https://devcenter.heroku.com/articles/php-support
! Push rejected, failed to compile PHP app.
! Push failed
This is my composer.json file
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"barryvdh/laravel-ide-helper": "^2.1",
"components/jquery": "2.1.4",
"components/jqueryui": "1.11.4",
"kodeine/laravel-acl": "^0.1.3",
"laravelcollective/html": "5.2.*"
},
"require-dev": {
"symfony/dom-crawler": "~3.0",
"symfony/css-selector": "~3.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
I ran have tried to deploy about a couple of dozens time after using composer install, composer update, composer update --lock and I even deleted the composer.lock file and ran composer update again but this error is not going anywhere. Please help!
It turned out that my vendor folder was not listed in .gitignore files and it was being pushed along with the other files on heroku. Once I added the vendor folder to .gitignore everything started working seamlessly.

Composer error: UnexpectedValueException

My composer suddenly stopped working. I didn't even add new packages, just wanted to check, if there are any updates:
PS C:\data\www\project.dev> composer self-update
You are already using composer version 1.3.2 (stable channel).
PS C:\data\www\project.dev> composer update
> php artisan clear-compiled
The compiled class file has been removed.
Loading composer repositories with package information
Updating dependencies (including require-dev)
[UnexpectedValueException]
Could not parse version constraint >=~2: Invalid version string "~2"
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock]...
All solutions I found so far suggested to update composer and check the composer.json, but there shouldn't nu anything wrong in there:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.3.*",
"edofre/laravel-fullcalendar-scheduler": "^1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "5.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
As you can see, there is nothing special in there.
PS: Of course, I already chkecked this and this, but those are unrelated problems.
EDIT:
The Problem is fixed in the 1.3.0#dev version of the composer-asset-plugin.
It can be installed via:
composer global require fxp/composer-asset-plugin:~1.3#dev
See also: https://github.com/fxpio/composer-asset-plugin/issues/270
I have tracked down your problem using the verbose output of composer.
The problem is initially caused by requiring
"edofre/laravel-fullcalendar-scheduler": "^1.0"
Within this some bower packages are required ( For this I assume you installed Composer Asset Plugin -at least I had to do this as stated in the docs of laravel-fullcalendar-scheduler)
One of these bower packages is for example:
"bower-asset/fullcalendar-scheduler": "v1.4.0"
The Bower fullcalender-schedulare has some dependencies ( in bower.json):
"dependencies": {
"jquery": "2 - 3",
"moment": "^2.9.0",
"fullcalendar": "~3.2.0"
},
The used composer asset plugin translates the jquery dependency to:
">=~2,<4.0"
This finally causes the error in the composer module https://github.com/composer/semver which raises an error composer/semver/src/VersionParser.php:485
For testing i have manually changed the version to >=2.0 which is working.
I currently have not investigated wheter this is a bug in the composer/semver lib or a bug in the composer asset plugin.
The composer docs say that ~2 is a valid version number, but I don't know if it is supposed to be used in comparisons like ">~2" ( in my oppionion this makes no sense at all... )

Deployment on Laravel Forge throwing faker not found Exception

I am trying to deploy a laravel project on forge and i am getting the below exception :
Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Faker\Factory' not found
I have the faker reference in require-dev in composer.json!
composer.json file
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"tymon/jwt-auth": "0.5.*",
"dingo/api": "1.0.x#dev"
},
"require-dev": {
"fzaninotto/faker": "~1.5",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"laracasts/testdummy": "1.*",
"laracasts/generators": "^1.1"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
Deployment script in Forge:
git pull origin master
composer install --no-interaction --no-dev --prefer-dist
php artisan migrate --force
php artisan db:seed --class="StaticDataSeeder"
I was able to deploy the same project locally with out any problem and composer update on forge also runs successfully and i can see the faker package getting downloaded.
Please let me know if i am missing something.
There is a clear conflict that explains your problem:
You've added the "fzaninotto/faker" package to the require-dev section.
You're running the deployment composer install command with the --no-dev option which explicitly prohibits installing the packages listed in require-dev.
So the solution is either to move the package to the require section or remove the --no-dev option when deploying.
I have same problem on heroku deployment i think it same, i fix with
moving "fzaninotto/faker": "~1.4" from "require-dev" to "require" in composer.json and composer.lock
composer install
composer update
git add
git commit
git push heroku
if you don't use heroku as deployment don't run from step 4-6
Run the next command:
composer install
And the problem should go away

Categories