作曲者:非空的PSR-4前缀必须以名称空间分隔符结尾

时间:2019-03-09 11:23:06

标签: php composer-php

即使我的composer.json看起来不错,我仍然遇到此错误。

这是我的作曲家文件

{
"name": "emmajiugo/chuck-norris-jokes",
"description": "Create random Chuck Norris Jokes",
"type": "library",
"license": "MIT",
"authors": [
    {
        "name": "emmajiugo",
        "email": "emmajiugo@gmail.com"
    }
],
"require": {},
"autoload": {
    "psr-4": {
        "Emmajiugo\\ChuckNorrisJokes\\": "src/"
    }
},
"autoload-dev": {
    "psr-4": {
        "Emmajiugo\\ChuckNorrisJokes\\Test": "tests"
    }
},
"require-dev": {
    "phpunit/phpunit": "^8.0"
}
}

我尝试运行作曲家自我更新,但仍然遇到错误。

有人请指教。

1 个答案:

答案 0 :(得分:2)

测试后,您缺少反斜杠。您的composer.json文件应如下所示:

{
    "name": "emmajiugo/chuck-norris-jokes",
    "description": "Create random Chuck Norris Jokes",
    "type": "library",
    "license": "MIT",
    "authors": [
        {
            "name": "emmajiugo",
            "email": "emmajiugo@gmail.com"
        }
    ],
    "require": {},
    "autoload": {
        "psr-4": {
            "Emmajiugo\\ChuckNorrisJokes\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Emmajiugo\\ChuckNorrisJokes\\Test\\": "tests/"
        }
    },
    "require-dev": {
        "phpunit/phpunit": "^8.0"
    }
}