无效的撰写文件安装依赖项

Posted

技术标签:

【中文标题】无效的撰写文件安装依赖项【英文标题】:invalid composer file installing dependancy 【发布时间】:2015-05-10 23:40:38 【问题描述】:

我正在尝试安装在这里找到的包:

https://cartalyst.com/manual/data-grid/3.0 我的作曲家文件如下:


    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": 
        "laravel/framework": "4.2.*"
,  "barryvdh/laravel-migration-generator": "dev-master", "fzaninotto/faker": "1.2.*@dev", "aws/aws-sdk-php": "2.*", "cartalyst/data-grid": "3.0.*"  ,

"repositories": [
    
        "type": "composer",
        "url": "https://packages.cartalyst.com"
    
]



    "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"

不幸的是,我的 json 无效,我无法修复它我已按照问题开头的链接按照安装说明进行操作,谢谢

【问题讨论】:

您可以通过jsonlint.com轻松检查任何语法错误 【参考方案1】:

repositories 数组和 autoload 对象之间需要一个逗号。

...
"repositories": [
    
        "type": "composer",
        "url": "https://packages.cartalyst.com"
    
],
"autoload": 
    "classmap": [
        "app/commands",
        "app/controllers",
        "app/models",
        "app/database/migrations",
        "app/database/seeds",
        "app/tests/TestCase.php"
    ]
,
...

【讨论】:

以上是关于无效的撰写文件安装依赖项的主要内容,如果未能解决你的问题,请参考以下文章

jar 的 POM 无效,传递依赖将不可用

ASP.NET Core 5 + SQL Server Docker 容器:无效的撰写项目

未找到 Maven 依赖项

编写高质量代码改善C#程序的157个建议——建议61:避免在finally内撰写无效代码

intellij idea解析本地maven仓库无效是为啥

安装失败并显示消息无效文件