Yii2: Can't Install Yii2 on Heroku.

Created on 18 Sep 2016  路  11Comments  路  Source: yiisoft/yii2

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

question

Most helpful comment

  • 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

All 11 comments

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

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.

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:

  • move yiisoft/yii2-debug to the require section of composer.json, run composer update, commit composer.lock and push changes to Heroku
  • do not use debug-panel on the prod environment.

Choose one of these and push your application again

_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.

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.

  • 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

@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?

  • 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 yiidebug\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.

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

thanks Silver

Was this page helpful?
0 / 5 - 0 ratings

Related issues

samdark picture samdark  路  63Comments

Faryshta picture Faryshta  路  48Comments

samdark picture samdark  路  52Comments

dhiman252 picture dhiman252  路  44Comments

AstRonin picture AstRonin  路  49Comments