Composer->不包含有效的JSON [英] Composer->does not contain valid JSON

查看:1317
本文介绍了Composer->不包含有效的JSON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用:作曲家搜索令牌"命令IDE抛出此错误.我无法从以下位置搜索任何下载包:packagist.org

Using: composer search 'tokens'command the IDE threw this error. I can't search neither download packages from: packagist.org

C:\ ProgramData \ ComposerSetup \ bin \ composer.bat搜索fosuserbundle

C:\ProgramData\ComposerSetup\bin\composer.bat search fosuserbundle

  [Seld\JsonLint\ParsingException]                                        
  "http://packagist.org/packages.json" does not contain valid JSON        
  Parse error on line 1:                                                  
  <HTML><HEAD><meta h                                                     
  ^                                                                       
  Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['  



search [-N|--only-name] tokens1 ... [tokensN]

推荐答案

在Windows计算机中,我已经按照所有这些步骤操作,并恢复了正确的行为(我的问题是composer require发生的,但是我认为这是由于与您使用composer search所描述的相同,或者例如是否要使用composer install.那么,让我们来看一下步骤:

In windows machine, I've followed all these steps and get back in a correct behaviour (my problem was happening with composer require, but I believe it's the same as you described using composer search or if we would be using composer install for example. So, let´s see the steps:

  1. 更新作曲家(`composer自我更新)
  2. 禁用IPV6(如官方文档中指出的指向,配置错误的IPV6设置是导致问题的常见原因)
  3. 删除(或重命名为repo_temp)文件夹%LOCALAPPDATA%\ Composer \ repo(以更新所有内容)
  4. 删除(或重命名为vendor_temp)项目中的供应商文件夹(以强制作曲家再次下载所有组件,然后
  1. Update composer (`composer self-update)
  2. Disable IPV6 (as pointed in official docs, misconfigured IPV6 setting is a common source of issues)
  3. Delete (or rename to repo_temp) your folder %LOCALAPPDATA%\Composer\repo (in order to have all contents updated)
  4. Delete (or rename to vendor_temp) your vendor folder inside your project (in order to force composer to download all components again, and as pointed in this thread comment)

完成这些步骤后,就我而言,问题就消失了!

After doing these steps, in my, case, the issue was gone!

(错误)之前的消息:

> composer require ...
...

"https://packagist.org/packages.json" does not contain valid JSON
Parse error on line 1:
▼\\\\\\♥��ݎ♀���
^
Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
https://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date

完成步骤后的消息(确定)!:

Message after doing the steps (OK)!:

> composer require ...

...

Writing lock file
Generating autoload files

这篇关于Composer-&gt;不包含有效的JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆