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

Install packages locally works not as expected (at least not from the User's Working Model point of view) #5658

Closed
sinkaszab opened this issue Sep 8, 2016 · 5 comments
Labels

Comments

@sinkaszab
Copy link

sinkaszab commented Sep 8, 2016

Install packages:

I successfully installed composer on Mac OS X 10.11.6. I installed it into a project directory.
So, composer will basically downloaded to: Users/MyUser/
My composer.phar then goes to Users/MyUser/Projects/project.local/
And then when I want to install a package, composer looks for the json in:
Users/MyUser/ dir
instead its project folder.
Kinda not good.

@alcohol
Copy link
Member

alcohol commented Sep 8, 2016

I installed it into a project directory.

What does that mean?

So, composer will basically downloaded to: Users/MyUser/

What? Why?

My composer.phar then goes to Users/MyUser/Projects/project.local/

Your composer.phar travels?

And then when I want to install a package, composer looks for the json in:

Install how? Be descriptive, tell us what command you run and where you run it.

Using issue template: ★★★☆☆
Issue description: ★☆☆☆☆
Overal experience: ★★☆☆☆

@alcohol alcohol added the Support label Sep 8, 2016
@sinkaszab
Copy link
Author

Okay, sorry, my bad...

I open a terminal and it basically gives me this starting point as of the location in the file system:
/Users/MyUser/

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" -> Works fine.
Puts composer-setup.php into: /Users/MyUser/ directory.

php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"-> Works fine.

php composer-setup.php --install-dir=Projects/Project/
I install the composer.phar into a local project directory. Which will then be located there form then on. (Full path then: Users/User/Projects/Project/composer.phar)

Then comes my problem when I would like to install a package.

php Projects/Project/composer.phar install
This doesn't work as I assumed. Because I would like my package to be installed here:
Users/User/Projects/Project/vendor/package
Instead the package will land here:
Users/User/vendor/package

So summarizing the problem:
I want composer to be local, but instead, packages will land on a global location.

@sinkaszab sinkaszab reopened this Sep 8, 2016
@sinkaszab
Copy link
Author

Sorry. I'm new...

@alcohol
Copy link
Member

alcohol commented Sep 8, 2016

Ah, okay, that explanation is much more useful. Thank you.

So the problem is that you want your working directory to be different from your current directory. You need to either cd into it, or pass it as an extra argument (-d / --working-dir).

So:

cd Projects/Project
php composer.phar install

or

php Projects/Project/composer.phar -d Projects/Project install

@sinkaszab
Copy link
Author

Yes! Works just as expected. However would be nice if that would be handled automatically OR mentioned in the documentation.

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

No branches or pull requests

2 participants