Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong bower path alias #14324

Closed
konorlevich opened this issue Jun 21, 2017 · 10 comments
Closed

wrong bower path alias #14324

konorlevich opened this issue Jun 21, 2017 · 10 comments

Comments

@konorlevich
Copy link

konorlevich commented Jun 21, 2017

What steps will reproduce the problem?

Fresh-installed yii2 base app

What do you get instead?

Invalid Parameter – yii\base\InvalidParamException
The file or directory to be published does not exist: /home/travkin/my_hosts/united_ua/vendor/bower/jquery/dist

Way to resolve

/vendor/yiisoft/yii2/base/Application.php line 461

Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower');

change to

Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower-asset');

Additional info

Q A
Yii version 2.0.12
@samdark samdark added severity:important type:bug Bug status:to be verified Needs to be reproduced and validated. labels Jun 21, 2017
@samdark samdark added this to the 2.0.13 milestone Jun 21, 2017
@shirase
Copy link
Contributor

shirase commented Jun 22, 2017

@konorlevich i think you need upgrade your fxp/composer-asset-plugin because installer-paths format is changed, and old version do not understands new format and installs to default bower-asset folder. Try run composer global require fxp/composer-asset-plugin.

@sizeg
Copy link
Contributor

sizeg commented Jun 27, 2017

define aliases in your config if in composer.json you use asset-packagist.org instead of fxp/composer-asset-plugin

'aliases' => [
    '@bower' => '@vendor/bower-asset',
    '@npm'   => '@vendor/npm-asset',
],

@sizeg
Copy link
Contributor

sizeg commented Jun 27, 2017

This string Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower'); cann't be changed cause of bc break

@moltam
Copy link
Contributor

moltam commented Jun 29, 2017

I had the same problem with fxp/composer-asset-plugin 1.2. The error disappeared after upgrading the plugin to version 1.3.

In Yii 2.0.12 the config options for the asset-plugin have changed (see), because the old config format was deprecated, and changed in fxp/composer-asset-plugin v1.3.

The section for the asset-plugin has been removed from the install guide in the master branch, and this causes confusion for new installs. This has been discussed at the related commit.

@schmunk42
Copy link
Contributor

Related fxpio/composer-asset-plugin#293

@SilverFire
Copy link
Member

@konorlevich Have you installed application template as it is listed in the manual?

@yii-bot
Copy link

yii-bot commented Jul 22, 2017

Thanks for posting in our issue tracker.
In order to properly assist you, we need additional information:

  • When does the issue occur?
  • What do you see?
  • What was the expected result?
  • Can you supply us with a stacktrace? (optional)
  • Do you have exact code to reproduce it? Maybe a PHPUnit tests that fails? (optional)

Thanks!

This is an automated comment, triggered by adding the label status:need more info.

@bahirul
Copy link

bahirul commented Jul 24, 2017

I had same problem, where i want overrides bower, npm, vendor alias.
I set alias on a bootstrap file, but seem yii/base/Application overrides it.
Maybe on setVendorPath method you can add validation is bower, npm, vendor not null.
So use value from Yii::setAlias on bootstrap file.

Thanks.

@bahirul
Copy link

bahirul commented Jul 24, 2017

Or maybe we can use oomphinc/composer-installers-extender globaly for replace fxp/composer-asset-plugin.
And then add :

"extra": { "installer-types": ["bower-asset", "npm-asset"], "installer-paths": { "vendor/bower/{$name}": ["type:bower-asset"], "vendor/npm/{$name}" : ["type:npm-asset"] } },

I solve my problem by doing this.

@konorlevich
Copy link
Author

konorlevich commented Jul 24, 2017

i think you need upgrade your fxp/composer-asset-plugin because installer-paths format is changed, and old version do not understands new format and installs to default bower-asset folder. Try run composer global require fxp/composer-asset-plugin

@shirase, thank you, it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants