Composer could not find the config file: C:\composer To initialize a project, please create a composer.json file - json

I'm trying to install Laravel on my Windows 10, I have set composer in PATH.
The steps that I have executed were:
create a folder called laravel in htdocs folder of xampp C:\xampp\htdocs\Laravel, then I used
cd C:\xampp\htdocs\Laravel
to access this folder then I ran the command
composer create-project laravel/laravel Laravel
While installing, I got this error
[InvalidArgumentException] Composer could not find the config
file: C:\composer
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section

Try deleting the environment variable. Try Control Panel-->System-->Edit the system environment variables-->Environment variables-->composer-->delete
Then try to create the laravel project normally.

Related

How to Install CakePHP Console?

I have a CakePHP 3.8 project hosted on github: https://github.com/paultrimor/pecunia
I can successfully clone the project, run composer install & configure app.php to have the application run.
However; the installation does not create a /bin directory, meaning that I cannot use the Console/Shell.
I am looking to install the Console on an existing CakePHP project
I receive the following message when I win composer install and `composer create-project --prefer-source``
> App\Console\Installer::postInstall
Set Folder Permissions ? (Default to Y) [Y,n]? n
Updated Security.salt value in config/app.php
> App\Console\Installer::postInstall
Set Folder Permissions ? (Default to Y) [Y,n]? n
No Security.salt placeholder to replace.
The first command replaces the "SALT" string to an actual hash in app.php; But, the second command tries to do the same thing, which it cannot.
Any pointers are appreciated. Thanks.
I think you already solved it looking at your repo, but the bin/ folder should be part of your repository. It will not be created with a composer install or composer update command.
If you create a new project using composer create-project cakephp/app --prefer-dist the bin/ executables will be placed. If you don't explicitly ignore it in .gitignore it will be available to all developers.
Step 1 : check PHP Version
php -v
Step 2: Install Composer
step 3: create a new CakePHP application using composer.
composer create-project --prefer-dist cakephp/app projectname
while installing it asking permission for folder just give yes
Set Folder Permissions ? (Default to Y) [Y,n]? Y
it will work.

No composer.json found in the current directory

Hi guys, really sorry if this has a basic answer as I'm quite new to this. I am following a YouTube tutorial Hyperledger Composer Development Tutorial (2/5) - Modeling Language (Mac OS X) https://www.youtube.com/watch?v=S2S5cEcmx7Q&t=100s.
Following all steps up to 3:22 (and tutorial 1/5) I try to command:
composer archive create -a /dist/perishables.bna --sourceType dir --sourceName
Where the result should be:
Creating Business Network Archive
Looking for package.json of Business Network Definition
Input directory: /Users/joeheade/composer-sample-networks/packages/perishable-network
Found:
Description: Shipping Perishable Goods Business Network
Name: perishable-network
Identifier: perishable-network#0.1.11
Written Business Network Definition Archive file to
Output file: ./dist/perishable-network.bna
Command succeeded
When I try, I get this:
Joe-Heades-MBP:perishable-network joeheade$ composer archive create -a /dist/perishables.bna --sourceType dir --sourceName
[Symfony\Component\Console\Exception\RuntimeException]
The "-a" option does not exist.
archive [-f|--format FORMAT] [--dir DIR] [--file FILE] [--ignore-filters] [--] [<package>] [<version>]
If I check the version I get this:
Joe-Heades-MBP:perishable-network joeheade$ composer --version
Composer version 1.5.5 2017-12-01 14:42:57
And for a generic command, I get this:
Joe-Heades-MBP:perishable-network joeheade$ composer archive create
Searching for the specified package.
No composer.json found in the current directory, searching packages from packagist.org
Could not find a package matching create.
Please could somebody help? I'm also sorry if I'm following any Stack Overflow rules incorrectly; this is my first post.
Thank you in advance!
UPDATE: In addition if I take a step back I get this result for:
Joe-Heades-MacBook-Pro:dist joeheade$ compose archive create -a dist/perishables.bna --sourceType dir --sourceName
-bash: compose: command not found
Following the steps https://github.com/composer/composer/issues/6303, I also get the following response:
Joe-Heades-MacBook-Pro:perishable-network joeheade$ composer update
Composer could not find a composer.json file in /Users/joeheade/composer-sample-networks/packages/perishable-network
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
You've not installed Hyperledger Composer. You have installed something else called composer that also has a command line name of composer.
Please refer to the documentation website https://hyperledger.github.io/composer/ for information about Hyperledger Composer and please ensure you uninstall the dependency manager for php (called composer).
You missed a small dot(.) on this command.
Before executing this command please make sure you have a dist in this directory folder.
composer archive create --sourceType dir --sourceName . -a ./dist/perishables.bna
Use this command to create a .bna (Business Network Archive) file. This should return the expected value.

Fatal Error PatchWork/utf8 with Laravel

I cloned a site on github, and i had an error with the vendor folder because it wasn't be installed with composer install or update so i've copied the vendor folder from a fresh laravel project and i don't have anymore the followed error :
bootstrap/../vendor/autoload.php. Failed to open stream: No such file or directory. The "vendor" folder does not exist.
but when i'm going to the public folder of laravel, i've this error again:
Fatal error: Class 'Patchwork\Utf8\Bootup' not found in C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\hguitare\laravel\bootstrap\autoload.php on line 46
I've tried to dump-autoload and composer update but nothing is working
I've also tried to add this line on the composer.json into required
"patchwork/utf8": "1.1.*"
Anyone can help me?
Try removing/commenting the 'Patchwork\Utf8\Utf8ServiceProvider' or the service provider related to this in config/app.php and then try installing by composer install

My composer.json does not install new dependencies using composer update command

I am installing external dependencies using composer update command. The following is the section of the composer.json file in c:\xampp\htdocs\myproject\vendor\laravel\framework\ directory.
"require": {
"laravelcollective/html": "~5.0",
"matriphe/imageupload": "5.1.*"
"illuminate/html": "5.0.*#dev"
},
I am getting the following results after running the composer update command:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
I have also tried to create another require array in the composer.json and added the packages I want to install with no success.
The composer update command could not install any unstalled dependency using the composer update command. Even composer self-update did not solve the problem.
Kindly assist me, I have been stuck here for some days now trying all I would do but without success.
I am changing the composer.json under the following directory: c:\xampp\htdocs\myproject\vendor\laravel\framework\ Is this ok?
Don't change any files inside the vendor directory, they are managed by Composer. To install further packages use the composer.json in your project's directory.
And use composer install to install new packages as composer update will update already installed packages to newer versions (if available) too.
composer self-update just updates Composer itself.
You missed column after "matriphe/imageupload": "5.1.*", try to change it:
"require": {
"laravelcollective/html": "~5.0",
"matriphe/imageupload": "5.1.*",
"illuminate/html": "5.0.*#dev"
}

Installing behat with mink on windows using composer

I am trying to install mink/behat on windows machine using composer by following the help given on behat page. http://docs.behat.org/cookbook/behat_and_mink.html.
But when I run
php composer.phar install
then I get the error
But I have composer.json(exactly same as described in behat page) file in mentioned directory. Can someone please guide me how can I install it. Thanks
Composer installs packages on project-base. I don't think you have a PHP project inside C:\Windows\system32...
Navigate to your project by using cd (change dir) and be sure the composer.phar file is automatically loaded in every directory (see this answer).
Then create a composer.json file in which you put the things that is stated in the docs.
After that run composer install (or php composer.phar install, depends on which install method you used).