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

The file or directory to be published does not exist: /usr/home/dima/advanced/vendor/bower/jquery/dist #6402

Closed
d-bo opened this issue Dec 7, 2014 · 74 comments
Assignees
Labels
status:to be verified Needs to be reproduced and validated.
Milestone

Comments

@d-bo
Copy link

d-bo commented Dec 7, 2014

Hello. Have some problems with separated advanced app skeleton install. What i've done:

composer asset plugin installed by

composer global require "fxp/composer-asset-plugin:1.0.0-beta4"

next yii2 framework

composer global require "yiisoft/yii2:2.0.*@dev"

the app-advanced skeleton in a separate folder /home/dima/advanced

composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced advanced

correct paths to autoload yii2 from /frontend/web/index.php generated by init

<?php
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
$vendor = '/home/dima/.composer/vendor';
require($vendor . '/autoload.php');
require($vendor . '/yiisoft/yii2/Yii.php');
require(__DIR__ . '/../../common/config/bootstrap.php');
require(__DIR__ . '/../config/bootstrap.php');

$config = yii\helpers\ArrayHelper::merge(
    require(__DIR__ . '/../../common/config/main.php'),
    require(__DIR__ . '/../../common/config/main-local.php'),
    require(__DIR__ . '/../config/main.php'),
    require(__DIR__ . '/../config/main-local.php')
);

$application = new yii\web\Application($config);
$application->run();

I tried to play with @Vendor and other paths
But can't resolve the error

The file or directory to be published does not exist: /usr/home/dima/advanced/vendor/bower/jquery/dist

@samdark
Copy link
Member

samdark commented Dec 7, 2014

Do you have bower under vendor? Any errors or warnings prior to this one?

@samdark samdark added the status:to be verified Needs to be reproduced and validated. label Dec 7, 2014
@samdark samdark self-assigned this Dec 7, 2014
@samdark samdark added this to the 2.0.x milestone Dec 7, 2014
@cebe
Copy link
Member

cebe commented Dec 7, 2014

Why do you install yii2 globally?

@d-bo
Copy link
Author

d-bo commented Dec 8, 2014

the last thing it was

$ composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced advanced1
Installing yiisoft/yii2-app-advanced (dev-master dec904b708687d49ba5dd300357b9cc657dd119c)
  - Installing yiisoft/yii2-app-advanced (dev-master master)
    Loading from cache

Created project in advanced1



  [ErrorException]
  file_put_contents(vendor/yiisoft/extensions.php): failed to open stream: No
   such file or directory

And the /vendor dir missing. So after a few hours of struggling i decided to delete my global .composer/ dir and repeat yii2 install.
And it works )

To Cebe. yii2 installed with another two massive php framework cores globally (composer global require).
I was wondering, can i use those cores separate from applications in this env and if i use composer autoload.php, are the classes wil be loaded by demand ...

Is there a way to move /vendor to global .composer/vendor dir and point advanced-app skeleton to use these dependencies from global path, so i can make application package without /vendor directory ?

@cebe cebe closed this as completed in b493a0a Dec 8, 2014
@cebe
Copy link
Member

cebe commented Dec 8, 2014

it is not a good idea to install yii globally because different applications may depend on different versions of yii. However I have checked in a fix for the yii2-composer plugin to create the directory in case it did not exist before.

@cebe cebe modified the milestones: 2.0.2, 2.0.x Dec 8, 2014
@cebe cebe assigned cebe and unassigned samdark Dec 8, 2014
@SaWey
Copy link

SaWey commented Dec 10, 2014

I think I had the same problem, trying to update from 2.0 beta to 2.0.1 stable, the framework was not update correctly and the '@bower' alias was still set to 'bower' instead of 'bower-asset'

@samdark
Copy link
Member

samdark commented Dec 10, 2014

@SaWey make sure that you have the following in your composer.json: https://github.com/yiisoft/yii2/blob/master/apps/basic/composer.json#L49

@asimzeeshan
Copy link

@SaWey same error here but the URL you just shared is inaccessible

Exception 'yii\base\InvalidParamException' with message 'The file or directory to be published does not exist: /home/xxxxxxxxx/public_html/vendor/bower/jquery/dist' 

@samdark
Copy link
Member

samdark commented Apr 24, 2015

@akosk
Copy link

akosk commented Apr 25, 2015

Same error here, after a fresh installation:

Invalid Parameter – yii\base\InvalidParamException
The file or directory to be published does not exist: /var/www/xxxxxx/vendor/bower/jquery/dist

There is no @app/vendor/bower directory in my project but @app/vendor/bower-asset.
Can you help me how can I fix this issue?

(Renaming the directory from bower-asset to bower solve the issue. I don't understand why it choosed 'bower-asset' directory name it was just bower previously.)

@lynicidn
Copy link
Contributor

try:

rm -rf ~/.composer/cache
rm -rf /path/to/project/vendor
rm /path/to/project/composer.lock
composer global require "fxp/composer-asset-plugin:1.0.0"
composer --prefer-dist install

it solve my problem

@cebe
Copy link
Member

cebe commented Apr 25, 2015

@akosk you probably miss these lines in composer.json: https://github.com/yiisoft/yii2-app-basic/blob/master/composer.json#L49-L52

@akosk
Copy link

akosk commented Apr 25, 2015

@cebe I did not miss those lines you can check it: https://github.com/akosk/jezsumenza/blob/master/composer.json#L49

Exactly what happened:

  1. On my local machine I create a project: composer create-project --prefer-dist yiisoft/yii2-app-basic jezsumenza
  2. I see @app/vendor/bower directory.
  3. I share it on Github.
  4. On my remote test server I clone this repo.
  5. I run composer install
  6. I see @app/vendor/bower-asset instead of @app/vendor/bower

@cebe
Copy link
Member

cebe commented Apr 27, 2015

I have tried but I am not able to reproduce it. Are you sure composer asset plugin is installed on the test server?

@cebe
Copy link
Member

cebe commented Apr 27, 2015

maybe your composer.lock contains some outdated things, run composer update in application and commit the new lock file.

@masrahman
Copy link

it doesn't solve my problem... please gimme another way..

@jcshep
Copy link

jcshep commented May 24, 2015

I had the same issue as akosk did with my vendor/bower folder being automatically named vendor/bower-assets. If anyone has info on this I'd like to know why it's happening.

@cebe
Copy link
Member

cebe commented May 26, 2015

@MGHollander
Copy link

The solution of @lynicidn worked form me!

@soltmar
Copy link

soltmar commented Sep 22, 2015

The solution of @lynicidn worked form me as well!

@CyberPunkCodes
Copy link

Same issue here. Yii2 advanced app, 2.0.6. Runs just fine on localhost in dev environment. Push to OpenShift (build has hooks to init and composer install).

Composer has extra lines added:

"fxp/composer-asset-plugin": "*",
"ext-gd": "*",

I SSH'd in and noticed I also had the "bower-asset" directory, instead of just "bower".

I ran composer clear-cache then composer update. It then updated composer-asset-plugin. Verified, and I now had bower directory. Only problem now, is the jQuery directory doesn't exist. Nothing is in the bower dir lol.

@CyberPunkCodes
Copy link

Yay! 👍

composer global require "fxp/composer-asset-plugin:1.0.0-beta4"

Also added: "fxp/composer-asset-plugin": "1.0.0-beta4" to composer.json

I kept running clear-cache, update.. still was missing jquery and complaining that it couldn't find a matching jquery version...

rm -rf vendor
composer install

Bingo!

@samdark
Copy link
Member

samdark commented Oct 6, 2015

Instead of 1.0.0-beta4 it's better to use ~1.0.3.

@Reedef
Copy link

Reedef commented Nov 28, 2015

I solve this problem after I set config composer global require "fxp/composer-asset-plugin:~1.1.1" and composer install

1.1.1 fix some bug when I do composer install or update encountered like this

Deprecation Notice: The Composer\Package\LinkConstraint\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead. in phar:///usr/local/bin/compose
r/src/Composer/Package/LinkConstraint/MultiConstraint.php:17
Deprecation Notice: The Composer\Package\LinkConstraint\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead. in phar:///usr/l
ocal/bin/composer/src/Composer/Package/LinkConstraint/LinkConstraintInterface.php:17

After update fxp version , just run composer install, you will see vendor/bower/( bootstrap jquery jquery.inputmask punycode typeahead.js yii2-pjax .... ),then you can rm -rf /vendor/bower/bower-asset

My Yii verision is Advance 2.0.6

@collegelafleche
Copy link

Don't forget to clear composer's cache after you update the fxp plugin.

Also, the download page should reflect the new fxp version instead of 1.0.3 to avoid confusion:
http://www.yiiframework.com/download

@cebe
Copy link
Member

cebe commented Dec 1, 2015

Also, the download page should reflect the new fxp version instead of 1.0.3 to avoid confusion:

fixed, thanks for pointing it out.

@joaquimforcada
Copy link

I was a big lover of Yii, but I really have to say that this issue installing Yii2 it really sucks. I have been for more than 2 hours trying to solve this, I am just installing a multi-app-project in Yii2 (first version) in a new machine for a demo, and still having the issue.
I am trying everything you say and it still does not work.

The Yii2 developers should do something to make this much more simple. This is starting to look like SYMFONY2 :).

@samdark
Copy link
Member

samdark commented Dec 4, 2015

@joaquimforcada we've learned a lesson and will try getting rid of global composer plugin in 2.1.

@joaquimforcada
Copy link

Well, in the end I had to create manually the directory vendor/bower/jquery/dist and vendor/bower/bootsrap/dist. I copied them from the bower-asset original one :
vendor/bower-asset/bower-asset/
to
vendor/bower/bootstrap/

Because none of the multiple solutions related with composer and bower and assets works for me. None creates the needed directories under bower/.

I am not a genius, but it wouldn't be as easy to change the path in the Yii vendor project?:
/vendor/yiisoft/yii2/web/JqueryAsset.php

Thank you anyway. I hope in some weeks this is solved or I will run again with the same issue on PRODUCTION.

@samdark
Copy link
Member

samdark commented Dec 4, 2015

Nope. It should work as it's coded. Again:

  1. Make sure you have global install of latest version of fxp plugin.
  2. Make sure your composer is latest.
  3. Make sure you have these lines in your composer.json.
  4. Delete vendor.
  5. Clear composer cache.
  6. Re-run.

@touqeershafi
Copy link

Yeah i got the same problem inmy project. However in composer.json i change this

"asset-installer-paths": {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor"
}

after running composer install it creates directory named vendor/bower-assets i renamed the directory to vendor/bower and it fixed my issue i know this is not the permanent solution. I got this error after cloning my repo from BitBucket.

@Faryshta
Copy link
Contributor

Faryshta commented Dec 7, 2015

@touqeershafi you shouldn't run composer install it should be composer create-project

@touqeershafi
Copy link

@Faryshta Why should i run this command? my project is already created, it was working fine in my home workstation but in office i got this error.

@Faryshta
Copy link
Contributor

Faryshta commented Dec 7, 2015

so you cloned the repo then? The cloning can be tricky, which steps you followed?

@touqeershafi
Copy link

I installed yii2 using composer from here almost 3 months ago and pushed my last changes on BitBucket on 27-11-2015 until then it was working fine because of my local copy of the project so i deleted that project from office machine because of holidays. So when i come office today i did this:

  1. git clone URL_TO_MY_REPO
  2. composer update

after running composer update composer downloaded all my required packages which are listed in package.json but when i run application it gives me error The file or directory to be published does not exist then i followed this to resolve my issue.

@Faryshta
Copy link
Contributor

Faryshta commented Dec 7, 2015

Try

  1. git clone URL_TO_MY_REPO FOLDER
  2. cd FOLDER
  3. composer create-project --repositoty-url=composer.json

Then paste here the shell messages.

@touqeershafi
Copy link

should i remove vendor folder ?

@Faryshta
Copy link
Contributor

Faryshta commented Dec 7, 2015

the instructions I gave are to start a new clone on FOLDER.

keep your current clone as it is, we will work on a new clone to see if we can reproduce the issue after using composer create-project

@touqeershafi
Copy link

After following your steps:

  1. git clone URL_TO_MY_REPO FOLDER
  2. cd FOLDER
  3. composer create-project --repositoty-url=composer.json

it gives me error: [RuntimeException] The "--repositoty-url" option does not exist.

@Faryshta
Copy link
Contributor

Faryshta commented Dec 7, 2015

a typo, sorry

composer create-project --repository-url=composer.json

@touqeershafi
Copy link

Well got the same error while running application:
The file or directory to be published does not exist: /home/tshafi/public_html/yii-oaa/vendor/bower/jquery/dist
Here is the pastebin of the shell.

Btw i've also tried your solution after running composer clear-cache but the same problem occurs.

@Faryshta
Copy link
Contributor

Faryshta commented Dec 7, 2015

on your composer.json change

        "bower-asset-library": "vendor"

to

        "bower-asset-library": "vendor/bower"

and run composer update

@fbarrento
Copy link

Same problem here.
After I rum composer update with:

    "extra": {
        "asset-installer-paths": {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor/bower"
        }
    }

it creates the following folders:

vendor/bower/bower-asset
and inside this folder are all the bower libraries
I move the libraries to the bower folder and it works

This is not a permanent solution. Because when I run composer update it moves the files again.

@Faryshta
Copy link
Contributor

Faryshta commented Dec 7, 2015

vendor/bower/bower-asset

it should just create /vendor/bower @francoispluchino got any idea why this folder is named like that?

I tried to reproduce it myself and I ran

sudo composer self-update
composer global update
composer update

I got no errors and I see no folder /vendor/bower/bower-asset. My assets work normally.

If that doesn't work I can't provide any more help sorry.

@francoispluchino
Copy link

@Faryshta Update your composer-asset-plugin to the last stable version (it's fixed).

@Faryshta
Copy link
Contributor

Faryshta commented Dec 7, 2015

Then composer global update should do the trick. Thanks @francoispluchino

@touqeershafi
Copy link

sudo composer self-update
composer global update
composer update

Does the trick every thing back to normal (y) thanks @Faryshta

@Faryshta
Copy link
Contributor

Faryshta commented Dec 8, 2015

@fbarrento did it solved it for you too? which version of the fxp asset plugi did you installed?

@zxczxc12
Copy link

Same problem

composer.json

{
    "name": "yiisoft/yii2-app-advanced",
    "description": "Yii 2 Advanced Application Template",
    "keywords": ["yii2", "framework", "advanced", "application template"],
    "homepage": "http://www.yiiframework.com/",
    "type": "project",
    "license": "BSD-3-Clause",
    "support": {
        "issues": "https://github.com/yiisoft/yii2/issues?state=open",
        "forum": "http://www.yiiframework.com/forum/",
        "wiki": "http://www.yiiframework.com/wiki/",
        "irc": "irc://irc.freenode.net/yii",
        "source": "https://github.com/yiisoft/yii2"
    },
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.4.0",
        "yiisoft/yii2": "*",
        "yiisoft/yii2-bootstrap": "*",
        "yiisoft/yii2-swiftmailer": "*",
        "yiisoft/yii2-jui": "*",
        "bower-asset/admin-lte": "^2.0",
        "bower-asset/font-awesome": "^4.0",
        "bower-asset/bootbox": "*",
        "bower-asset/html5shiv": "^3.0"
    },
    "require-dev": {
    "yiisoft/yii2-debug": "~2.0",
        "yiisoft/yii2-codeception": "*",
        "yiisoft/yii2-faker": "*",
        "yiisoft/yii2-gii": "*",
        "trntv/yii2-debug-xhprof": "dev-master@dev"
    },
    "config": {
        "process-timeout": 1800
    },
    "extra": {
        "asset-installer-paths": {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor/bower"
        },
        "asset-registry-options": {
            "npm-searchable": false,
            "bower-searchable": false
        },
        "yii\\composer\\Installer::postCreateProject": {
            "setPermission": [
                {
                    "frontend/runtime": "0777",
                    "backend/runtime": "0777",
                    "console/runtime": "0777",
                    "frontend/web/assets": "0777",
                    "backend/web/assets": "0777"
                }
            ]
        }
    }
}

composer self-update

composer self-update
You are already using composer version 1c525b76f81123af180743d31c208c29351cf931.

composer global require "fxp/composer-asset-plugin:1.0.3"

./composer.json has been updated

composer global show -i

fxp/composer-asset-plugin v1.0.3 NPM/Bower Dependency Manager for Composer

composer global update

Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update

*Delete vendor dir

composer global clear-cache

Changed current directory to C:/Users/Sergo/AppData/Roaming/Composer
Clearing cache (cache-dir): C:\Users\Sergo\AppData\Local\Composer
Clearing cache (cache-files-dir): C:\Users\Sergo\AppData\Local\Composer\files
Clearing cache (cache-repo-dir): C:\Users\Sergo\AppData\Local\Composer\repo
Clearing cache (cache-vcs-dir): C:\Users\Sergo\AppData\Local\Composer\vcs
All caches cleared.

composer update
...

Result is same:

Invalid Parameter – yii\base\InvalidParamException
The file or directory to be published does not exist: >E:\OpenServer\domains\mydomain.loc/vendor\bower/jquery/dist

:-((((((((((((

@collegelafleche
Copy link

composer global require "fxp/composer-asset-plugin:1.0.3"

Update your fxp plugin to latest version (1.1.1), clear composer's cache and try again.

@zxczxc12
Copy link

YEEEEESSSS !!!!
Thank You !

@zucolli
Copy link

zucolli commented Dec 30, 2015

This solution!

touqeershafi commented 23 days ago
sudo composer self-update
composer global update
composer update
Does the trick every thing back to normal (y) thanks @Faryshta

Thanks

@yiisoft yiisoft locked and limited conversation to collaborators Dec 30, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:to be verified Needs to be reproduced and validated.
Projects
None yet
Development

No branches or pull requests