yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.23k stars 6.91k forks source link

Can't Install Yii2 on Heroku. #12558

Closed pareekbhagu closed 8 years ago

pareekbhagu commented 8 years ago

I'm trying to install Yii2-basic-application template on Heroku. But I'm facing dependency/composer issues.

The application runs perfectly on local machine, but while deploying to heroku, it throws a ReflectionClass Error, (Class yii\debug\Module not found). This exception is about yii2-debug module (https://github.com/yiisoft/yii2-debug). I don't know anything about the internal workings of composer. I have run composer update, composer dump-autoload but no help. The files actually exist on the server, which makes me think it might be a problem about class-mapping in composer related files.

I would also appreciate alternate workarounds, as it is critical.

If it is the composer-asset-plugin that is causing it, Isn't there a manual workaround ? Shouldn't it be mentioned somewhere on forums, while Yii team fixes it in the next upcoming version of Yii2, a working solution that can atleast ENSURE that application will install perfectly.

Additional info

Q A
Yii version 2.0.?
PHP version
Operating system
mdmunir commented 8 years ago

Are you using option --no-dev in composer?

pareekbhagu commented 8 years ago

no. Didn't run composer update with -no-dev option ..my require-dev section is here ..

"require-dev": { "yiisoft/yii2-codeception": "*",

    "yiisoft/yii2-gii": "*",
    "yiisoft/yii2-faker": "*"
},

I moved the yii2-debug from required-dev to required.

SilverFire commented 8 years ago

Heroku uses composer install with --no-dev as a default. You have debug listed in bootstrap section of Yii application config, but do not have dev-dependencies installed.

You can either:

Choose one of these and push your application again

yii-bot commented 8 years ago

This is an automated comment, triggered by adding the label question.

Please note, that the GitHub Issue Tracker is for bug reports and feature requests only.

We are happy to help you on the support forum, on IRC (#yii on freenode), or Gitter.

Please use one of the above mentioned resources to discuss the problem. If the result of the discussion turns out that there really is a bug in the framework, feel free to come back and provide information on how to reproduce the issue. This issue will be closed for now.

SilverFire commented 8 years ago

Proof: http://yii2-basic-app.herokuapp.com/

pareekbhagu commented 8 years ago

I shall be so thankful if you could kindly list the exact steps you followed to make the above app running? That way I might get an insight into what am I doing wrong.

SilverFire commented 8 years ago

Something like this

nathanscain commented 4 years ago

@SilverFire I am having an issue with routing on an Advanced Yii2 install. All views other than index return not found. I have been searching with no hope. Just loaded your heroku above, and it too has issues with routing. (all the links result in 404s)

Any ideas?

omzy commented 4 years ago
  • Open composer.json and move yiisoft/yii2-debug, yiisoft/yii2-gii from require-dev to the require section
  • composer update
  • git add composer.lock composer.json && git commit -m 'updated composer.json'
  • git push heroku master

Something like this

How is this a valid solution? On production I don't need dev dependencies, so I should be able to install by doing composer install --no-dev. However this results in the error message "ReflectionException : Class yii\debug\Module does not exist".

Yes I have debug listed in the application config, but this is enclosed within if (YII_ENV_DEV) {. So it should never try to load it in.

samdark commented 4 years ago

@omzy It should not be loaded if it's enclosed properly...

guillovale commented 3 years ago

thanks Silver