composer installed.json" does not contain valid JSON - php

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

Related

composer global require fails where non global equivalent succeeds

Im developing a package available at packagist as user/package. Installing it locally works just fine
composer require user/package
Creating a new project is also fine
composer create-project --prefer-dist user/package new-project
But the package is to be deployed globally
composer global require user/package
however this results in the following error log.
Changed current directory to /home/anders/.composer ./composer.json
has been updated Loading composer repositories with package
information Updating dependencies (including require-dev) Your
requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for user/package ^v0.0.3 -> satisfiable by user/package[v0.0.3].
- Conclusion: remove illuminate/container v5.5.2
- Conclusion: don't install illuminate/container v5.5.2
- don't install tightenco/collect v5.4.33|don't install laravel/framework v5.5.2
- don't install laravel/framework v5.5.2|remove tightenco/collect v5.4.33
- Installation request for illuminate/container (installed at v5.5.2) -> satisfiable by illuminate/container[v5.5.2],
laravel/framework[v5.5.2].
- Installation request for tightenco/collect (installed at v5.4.33) -> satisfiable by tightenco/collect[v5.4.33].
Installation failed, reverting ./composer.json to its original
content.
How can this be?
I have tried composer global clearcache
Deleted a composer.lock file I found directly under /home/anders/.composer/
Upgraded my dependencies (Laravel) from 5.5.x to 5.6.x with no effect
Even creating a fresh "laravel new blog" project and uploading to packagist fails with the same error message.
Here is my composer.json
{
"name": "user/package",
"description": "Package",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"ajthinking/tinx": "^2.1",
"fideloper/proxy": "~3.3",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~6.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"bin": [
"package"
]
}
Would really appreciate help interpreting the error log. Thanks!
Update
This is the content of /home/anders/.composer/
{
"require": {
"cpriego/valet-linux": "^2.0",
"laravel/installer": "^1.4",
"phpunit/phpunit": "^6.4",
"phpunit/dbunit": "^3.0"
}
}
Composer version: 1.6.5
If this is standalone tool, you should consider building PHAR for it. You can use kherge/box to simplify build process.
PHAR archive is completely standalone, so you'll get rid of all problems with conflicting global dependencies. It may also simplify installation (you need to just download archive and make it executable) for both global and local installation.

i can not install laravel passport

composer require laravel/passport ^v1
result command
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.22) does not satisfy that requirement.
- doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.22) does not satisfy that requirement.
- Installation request for doctrine/instantiator (installed at 1.1.0) -> satisfiable by doctrine/instantiator[1.1.0].
Installation failed, reverting ./composer.json to its original content.
my composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.22",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"laravel/passport": "^1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
},
"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"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
how can i solved it
Install php 7.1 and you will be fine.
For ubuntu
https://www.vultr.com/docs/how-to-install-and-configure-php-70-or-php-71-on-ubuntu-16-04
For windows
http://php.net/manual/en/install.windows.php
You have to update your php version to be 7, after that you have to re install your composer and make sure that it will take correct php version

composer require laravelcollective html 'doesnt download dependancy

Please see when When I run composer install please assist,
I am new to laravel and I cannot download dependency for laravelcollective/html ... I am using laravel 5.5.13
I want to require laravelcollective/html
however I face the following problems.
when I run : composer require "laravelcollective/html:5.2.*",
I get the below mentioned(similarly when I run composer update ) :
C:\Users\MALULEKE\Desktop\lara_proj\shops>composer require "laravelcollective/html:5.2.*"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package laravelcollective/html could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Installation failed, reverting ./composer.json to its original content.
C:\Users\MALULEKE\Desktop\lara_proj\shops>composer require "laravelcollective/html:5.2.*"
below is my composer.json relative to my project's work (not from composer/roaming, I am not even sure which is it I must use, please help )
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*#dev",
"laravel/tinker": "~1.0",
"laravelcollective/html":"~5.3.#dev"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~6.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
Try running composer require laravelcollective/html which will install the latest version of LaravelCollective packages for you.
I have decided to use AngularJS as my front end.
Note that this solution may not be suitable for everyone, and with this solution, problems may arrive in future, due to the need for other composer requirements, such as authentication dependencies that my be needed.

composer update failed Your requirements could not be resolved to an installable set of packages

I have this composer file
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"laravel/framework": "4.2.*",
"guzzlehttp/guzzle": "~4.0",
"zizaco/confide": "~4.0#dev",
"zizaco/entrust": "1.2.*#dev",
"way/generators": "~2.0",
"zurb/foundation": "5.0.3",
"artdarek/oauth-4-laravel": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "4.4.*"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "stable"
}
when I run
composer update
I got this error
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for artdarek/oauth-4-laravel dev-master -> satisfiable by artdarek/oauth-4-laravel[dev-master].
- artdarek/oauth-4-laravel dev-master requires lusitanian/oauth dev-master -> satisfiable by
lusitanian/oauth[dev-master] but these conflict with your requirements
or minimum-stability.
I beleive that the error is in artdarek/oauth-4-laravel but I don't know how to reslove it, any help please?
I found this page [Composer fails when installing a dependency of a dependency, but not when the dependency is installed directly][1] helpful and it fixes my problem, I have changed
"artdarek/oauth-4-laravel": "dev-master"
to
"artdarek/oauth-4-laravel": "#dev"
Does anyone know what is the difference?
Try adding "lusitanian/oauth" : "dev-master" to the require list.
FYI, it is better to use specific versions since you are seeking stability :)

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

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

Categories