简体   繁体   中英

Composer json does not contain valid JSON

Hello I am trying to use laravel but i fail with the installation of composer.

I am using a windows 7 and when I install the setup of composer there is not any problem. The problem come when I use the comand composer -V it return to me these error .

I do not undestand what it means. if someone can explain to me the error. Thanks for read it. And sorry if there are some post like these but where i could read i do not undesrtand nothing.

paste composer.json file on a validator and it should point out the syntax error

try http://www.jsonlint.com

It returns the error:

Parse error on line 1:
MZ
^
Expecting one of: 'String', 'Number', 'Null' ... {', '['

Kindly check your entire JSON must start from '{' and end from '}' so your invalid JSON convert into Valid JSON.

Copy your JSON into this website: http://jsonlint.com/

First make sure that you can use php on your command line. You can run:

php -v 

This should give you the php version. If not, add the php executable to your windows path file ( https://stackoverflow.com/a/7307581/1354222 ).

Run this in your bash window, in the laravel folder, to get the latest composer version (installation instructions are from the composer website):

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === 'aa96f26c2b67226a324c27919f1eb05f21c248b987e6195cad9690d5c1ff713d53020a02ac8c217dbf90a7eacc9d141d') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Then use the following command to install laravel (from the laravel website, slightly adapted for your situation):

php composer.phar create-project --prefer-dist laravel/laravel blog

try update you vendor/composer/installer.json to following.

{}

this same happened to me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM