[RuntimeException] Unable to detect application namespace

Hi to all!

When I use cmd command

php artisan make:command FooCommand

i get runtime error from thread subject. May be someone decide this problem?

Thanks in advance.

esomkin
esomkin
  • 2 years ago
esomkin
Solution

Problem solved. It's my oversight )

Why not post your solution so when people google it and open the first result they don't just see "problem solved"?!?

For me the solution was to fix the composer.json file in the project. Under require-dev I had

    "require-dev": {
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1",
    },

At one point I had 3 in there and when I removed it I forgot to remove the 2nd comma. Once I fixed this code make:request executed appropriately.

    "require-dev": {
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1"
    },

@brent2890 thanks for this, I had a comment in the composer.json file and it totally blocked the make requests. Nice spot. :)

Same problem Same solution for me, it was caused by and extra , camma in my composer.json file

Thanks, Brent2890, same solution worked for me. I had an additional character in the composer.json file

to be honest I had the same problem and it was solved by removing a comma from the require-dev section

Yes I had the same issue and then solved by removing the comma in the composer.json file, thanks OP!

The CLI command : "composer diagnose" (without the double quotes) is very handy for checking syntax errors in the composer.json file .

Worked for me, some missing brackets, so its safe to say, This namespace error indicates that there is an error with the composer.json file.

Thanks!

Thanks! Worked for me. Apparently you have to eliminate the extra commas. Regardless of where it is, in my case it was in "require" instead of "require-dev"