So I've installed composer and it can't be called via cmd. Everytime I run composer via cmd command line it will show me like this :
I forgot what I did to composer command but I think it was some echo command in #php. So any ideas to solve this? Thanks
Is it in your PATH? You may need to add it to your PATH in order for it to be "found" and executed when you call composer in the command prompt.
Check out the docs here: https://getcomposer.org/doc/00-intro.md#installation-windows
UPDATE:
So I uninstalled the composer, removed the left-over directory manually at C:\Users\<user>\Composer , C:\Users\<user>\AppData\Local , C:\Users\<user>\AppData\Roaming , removed composer PATH at Environment Variables, then reinstalled it by running the ComposerSetup.exe from https://getcomposer.org , re-adding the composer PATH at Environment Variables (in my case C:\Users\<user>\composer) and it works. Composer can be called globally from cmd.
Related
I was trying to install laravel after i installed composer and made sure it's working by typing composer on my cmd but right after i added this line on cmd i became unable to see composer command working
composer global require "laravel/installer"
Now when i type composer it does nothing just like that
And here list of the current windows variables
The problem was that there was 2 files composer.phar and composer.bat inside my user folder "C:\Users\Yasser" which opens on cmd by default when i removed these 2 files i was able to use the command composer normally thanks to Peh
I installed Composer via Composer windows installer and it installed to the path C:\ProgramData\ComposerSetup. The composer.phar file is in the bin folder in the directory (C:\ProgramData\ComposerSetup\bin). I have added the Composer PATH to the environment variable. But even after that, I can't make Composer get start by typing composer in the command prompt. Can you help me? I have tried installing it manually in different directories and so far no success.
I have downloaded Console2 and inside it, Composer works just fine. But the windows command prompt doesn't do anything unless I'm in the installation directory.
I am trying to try this tool https://github.com/bramus/mixed-content-scan
So, I install a package through command prompt using composer
This is the installation command that I run: composer global require bramus/mixed-content-scan ~2.1
When I try to run mixed-content-scan https://www.bram.us/ in the command prompt, it says that command is not exist yet. Why is that? What did I do wrong?
Thanks before! :D
Most probably, you do not have the directory where composer symlinks the executable files in your PATH.
Add ~/.composer/vendor/bin to your $PATH environment variable, restart your shell and try again.
It's just like the answer from Wondra. It's answered by the composer package owner himself.
I just need to use this on command prompt: SET PATH=%PATH%;C:\Users\Ami\AppData\Roaming\Composer\vendor\bin
More information here https://github.com/bramus/mixed-content-scan/issues/20#issuecomment-78285213
I have composer installed, but checking the Laravel docs, I'm struggling with:
"Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable is found when you run the laravel command in your terminal."
I'm not sure what to do here, could someone explain it to me?
Go to terminal and paste the next line:
nano ~/.bash_profile
After that paste the next line in nano:
export PATH="$PATH:$HOME/.composer/vendor/bin"
Done. Restart your terminal and enjoy laravel.
The PATH environment variable tells your system where to look when you run a command. By default ~/.composer/vendor/bin will not be in your PATH. Therefore, if you just attempt to run the command laravel after installing it via composer, your terminal will give you an error saying the command is not found. But if you use the entire path to the command (~/.composer/vendor/bin/laravel), it will execute successfully.
When you run the command composer global require "laravel/installer=~1.1", composer puts the laravel installer into the directory ~/.composer/vendor/bin (in *nix, ~ represents your home directory). Adding ~/.composer/vendor/bin to your PATH allows you to just execute the command laravel instead of having to use the full path of ~/.composer/vendor/bin/laravel.
Helpful Stuff:
How to set/change your PATH environment variable in OSX
Installing composer packages globally
I want to create a laravel project by composer. I try to run this:
composer create-project laravel/laravel c:/laravel --prefer-dist
There is an error which is:
[InvalidArgumentException]
Composer could not find the config file: C:\ProgramData\ComposerSetup\bin
To initialize a project, please create a composer.json file as described in
the http://getcomposer.org/ "Getting Started" section
The composer.json file is:
{
"require": {
"laravel/laravel": "4.2.0"
}
}
I am using windows 8 and use cygwin.
I also have a proxy on my computer so I set the path of HTTP_PROXY_REQUEST_FULLURI and HTTPS_PROXY_REQUEST_FULLURI to 0 and false
Any idea?
Delete the environment variable composer. And It will work.
I found the solution like this:
COMPOSER=composer.json composer create-project laravel/laravel c:/laravel --prefer-dist
and it works!
See: Composer on Windows 7 (x64): issue #1720
The link above recommends that you delete the environment variable COMPOSER.
I have tried, and it worked.
I deleted the environment variable composer. Worked for me.
did you put your composer.json under c:/Laravel? if yes
in your cmd:
C:\> cd Laravel
C:\Laravel> composer create-project laravel/laravel project-name --prefer-dist
Just a note to everybody make sure to restart your doc command prompt windows after you remove the env by going to start type env press on Environmental, under system look for composer and remove the line. I spent an hour till i realized that i needed to restart the dam command window.
Note: As suggested above remove Environment variables, if you remove the environment variable you may not be able to run the composer command successfully, depending on how many times composer is defined in your variables.
as for me I had different composer environment variables from continuous tweaking, I had to delete them all, I decided to re-install composer using the windows installer and ticked the box that says install as developer (without including uninstall files), the I checked to see where it would install it and it showed my C:\ directory, so I accepted.
After successful install I opened new git bash in my project directory, and ran the
composer install
command. and it was successful.
I found a solution and it worked.
You have a COMPOSER environment variable defined and set to C:\ProgramData\ComposerSetup\bin.
You should unset/delete that env var.
You shouldnt erase the environment variable to work.
If the variable name was composer, you only must change the name to composerpath.
It's work to me.