How to Fix Cakephp 4 Composer Install Error - cakephp

Having issues installing all packages for cakephp 4.0 via Composer. Running a fresh wamp server install on Windows with PHP 7.4.0
Here is composer output. Using the command found in the cakephp docs.
www/> composer create-project --prefer-dist cakephp/app:^4.0 myapp
Installing cakephp/app (4.0.0)
- Installing cakephp/app (4.0.0): Loading from cache
Created project in kollectit
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package cakephp/bake ^4.0 exists as cakephp/bake[0.1.0, 0.1.10, 1.0.0, 1.0.1, 1.0.10, 1.0.11, 1.0.12, 1.0.13, 1.0.14, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.0.8, 1.0.9, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.10.0, 1.10.1, 1.11.0, 1.11.1, 1.11.2, 1.12.0, 1.2.0, 1.2.1, 1.2.10, 1.2.11, 1.2.12, 1.2.13, 1.2.14, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.2.7, 1.2.8, 1.2.9, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.6.0, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.8.0, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.8.6, 1.8.7, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.9.5, 1.9.6, 1.x-dev, 2.0.0, 2.0.1, 2.0.2, 2.0.3, dev-3.next, dev-dereuromark-patch-1, dev-fix-old-alias, dev-master, dev-twigview-5] but these are rejected by your constraint.
Problem 2
- Installation request for cakephp/migrations 3.0.0-beta1 -> satisfiable by cakephp/migrations[3.0.0-beta1].
- cakephp/migrations 3.0.0-beta1 requires robmorgan/phinx 0.11.x-dev -> no matching package found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
- It's a private package and you forgot to add a custom repository to find it
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
The base cakephp installation is there in the /myapp folder, but wondering on the errors and if they are needed (if so how to resolve? )
Here is the composer.json that is created:
{
"name": "cakephp/app",
"description": "CakePHP skeleton app",
"homepage": "https://cakephp.org",
"type": "project",
"license": "MIT",
"require": {
"php": ">=7.2",
"cakephp/cakephp": "^4.0",
"cakephp/migrations": "3.0.0-beta1",
"cakephp/plugin-installer": "^1.0",
"mobiledetect/mobiledetectlib": "2.*"
},
"require-dev": {
"cakephp/bake": "^4.0",
"cakephp/cakephp-codesniffer": "dev-next",
"cakephp/debug_kit": "^4.0",
"josegonzalez/dotenv": "3.*",
"phpunit/phpunit": "^8.0",
"psy/psysh": "#stable"
},
"suggest": {
"markstory/asset_compress": "An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.",
"dereuromark/cakephp-ide-helper": "After baking your code, this keeps your annotations in sync with the code evolving from there on for maximum IDE and PHPStan/Psalm compatibility."
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Test\\": "tests/",
"Cake\\Test\\": "vendor/cakephp/cakephp/tests/"
}
},
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall",
"post-create-project-cmd": "App\\Console\\Installer::postInstall",
"post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump",
"check": [
"#test",
"#cs-check"
],
"cs-check": "phpcs --colors -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/",
"cs-fix": "phpcbf --colors --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/",
"stan": "phpstan analyse src/",
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan-shim:^0.11 && mv composer.backup composer.json",
"test": "phpunit --colors=always"
},
"prefer-stable": true,
"config": {
"sort-packages": true
},
"minimum-stability": "dev"
}
Thanks!

You need to install the latest app template (4.0.2 currently), there have been some fixes around this.
The problem is that you are using ^ on the Windows command line, where the caret character is an escape character, ie it's not being passed to composer, which will only receive cakephp/app:4.0, which means that it will install 4.0.0.
Simple fix, enclose the package argument in double quotes:
composer create-project --prefer-dist "cakephp/app:^4.0" myapp
or do not specify a version constraint at all, which will automatically give you the latest stable version:
composer create-project --prefer-dist cakephp/app myapp

Related

Liferay npm-react-portlet reference error, module is not defined

So, I am developing React portlet for Liferay 7.0 CE. I have used blade command ( straight from the Liferay react template)
blade create -t npm-react-portlet -p fi.liferay.react.portlet -c ReactMain TestProject
Blade creates project as it should. After creation I changed to newly created project and ran
./gradlew build --stacktrace
First time build prints
npm WARN deprecated babel-preset-es2015#6.24.1: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
And after that
Execution failed for task ':npmRunBuild'. > Process command '<pathToProject>/build/node/bin/node'' finished with non-zero exit value 1
-> Build failed.
When running again gradle build, build passes
When deploying to Liferay portal, browser console prints
ReferenceError: module is not defined[Learn More]
combo:1:1
Error: Load timeout for modules: TestProject#1.0.0
Stack trace:
require/</</s<#http://localhost:8080/o/frontend-js-web/everything.jsp?browserId=firefox&themeId=classic_WAR_classictheme&colorSchemeId=01&minifierType=js&minifierBundleId=javascript.everything.files&languageId=en_US&b=7004&t=1521557570840:288:322
I am using npm version 5.6.0 and Node version 9.8.0 . Blade CLI version is 2.3.1.201711201552
Operating system is MacOs High Sierra Version 10.13.3
I have tried with new portal and with Google Chrome and Mozilla firefox
It caused by the upgrade of liferay npm build tools.
It will be fixed after the new release of blade cli.
And you can also fix it by change your package.json file like the following:
{
"dependencies": {
"react": "15.6.2",
"react-dom": "15.6.2"
},
"devDependencies": {
"babel-cli": "6.26.0",
"babel-preset-es2015": "6.24.1",
"babel-preset-liferay-project": "1.6.1",
"babel-preset-react": "6.24.1",
"liferay-npm-bundler": "1.6.1",
"liferay-npm-bundler-preset-react": "1.6.1"
},
"main": "js/index.js",
"name": "npm-react-portlet70",
"scripts": {
"build": "babel --source-maps -d build/resources/main/META-INF/resources src/main/resources/META-INF/resources && liferay-npm-bundler"
},
"version": "1.0.0"
}
Hope that can fix your problem.

Using composer.phar on wamp64 cakephp3 upgrade

I am using wamp64 and I want to upgrade to the latest stable release of cakephp3. I have current version 3.2.x
I ran the command from where the cakephp application called crm is installed. I run this from the docs but it doesnt work.
php composer.phar require "cakephp/cakephp:3.4.*"
error:Could not open input file: composer.phar
Looked up the issue annd could someone tell me what the official way to run the upgrade on wamp64?
Running Composer returns: "Could not open input file: composer.phar"
{
"name": "cakephp/app",
"description": "CakePHP skeleton app",
"homepage": "http://cakephp.org",
"type": "project",
"license": "MIT",
"require": {
"php": ">=5.5.9",
"cakephp/cakephp": "~3.2",
"mobiledetect/mobiledetectlib": "2.*",
"cakephp/migrations": "~1.0",
"cakephp/plugin-installer": "*"
},
"require-dev": {
"psy/psysh": "#stable",
"cakephp/debug_kit": "~3.2",
"cakephp/bake": "~1.1"
},
"suggest": {
"phpunit/phpunit": "Allows automated tests to be run without system-wide install.",
"cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP."
},
"autoload": {
"psr-4": {
"App\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"App\\Test\\": "tests",
"Cake\\Test\\": "./vendor/cakephp/cakephp/tests"
}
},
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall",
"post-create-project-cmd": "App\\Console\\Installer::postInstall",
"post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump"
},
"minimum-stability": "stable",
"prefer-stable": true
}
You would need the composer.phar file to be in the directory you are running the command from. Assuming this is in your code directory verify the composer.phar file exists. .phar is a php archive file or for simpler understanding it is a self contained application. If that file doesn't exist you would not be able to run and composer commands.
Likely all you will need to do is install composer.https://getcomposer.org/doc/00-intro.md#installation-windows
In my case, i also faced the same problem. I have upgraded my project from cakephp3.5 to 3.7. I have solved it by following command- (to run this command make sure your composer is installed globally)
composer require --update-with-dependencies "cakephp/cakephp:3.7.*"

How do i install fos-user-bundle "#2.0" alongside with Sonata-user-bundle?

I'm new to symfony framework
I installed FOSUserBundle "#2.0" and SonataAdminBundle
they are both working fine
now i wanted to install SonataUserBundle to manage my users
but in the downloading process [via composer] he said that SonataUserBundle is only compatible with FOSUserBundle "*1.3"
what SonataUserBundle accomplish ?
How can i install it with fos-user-bundle "#2.0"
For now SonataUserBundle doesn't support FOSUserBundle "2.0".
But there is alternative brunch - add_support_for_fos_user2.
You can plug it by this line:
composer require sonata-project/user-bundle dev-add_support_for_fos_user2
NOTE:
This bundle requires PHP >= 7.0 version.
Point it out in composer.json file (for example v. 7.1.0):
"config": {
"platform": {
"php": "7.1.0"
}
},

cakephp websocket ratchet install error

I am trying to install Cakephp Ratchet Plugin in existing project.
My CakePHP version is 2.4.3.
It says to follow this link which has following steps:
$ cd myproject/app/
$ curl -s https://getcomposer.org/installer | php
$ php composer.phar require --no-update opauth/opauth:dev-wip/1.0 opauth/twitter:dev- wip/1.0
$ php composer.phar config vendor-dir Vendor
$ php composer.phar install
I am not very familiar with composer and when i do the last step,it shows following error....
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package opauth/opauth could not be found in any version, there may be a typo in the package name.
Problem 2
- The requested package opauth/twitter could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
EDIT:
Composer.json is like this
{
"require": {
"opauth/opauth": "dev-wip/1.0",
"opauth/twitter": "dev-wip/1.0"
},
"config": {
"vendor-dir": "Vendor"
}
}
As already mentioned in my comment, the Ratchet Plugin has nothing to do with Opauth, the linked article over at ceeram.github.io should only serve as an example on how to configure Composer and the CakePHP bootstrap.
However, for Composer autoloading in CakePHP I'd recommend to refer to the CakePHP cookbook, even if you're not including CakePHP itself via Composer:
http://book.cakephp.org/2.0/en/installation/advanced-installation.html
Long story short, what the "Getting Started / 2. Composer" section of the plugin docs want you to do, is to require the ratchet plugin, to make sure the vendor dir points to /app/Vendor/, and to include the Composer autoloader in your bootstrap.php.
composer.json (assuming it's placed in /app)
{
"require": {
"wyrihaximus/ratchet": "dev-master"
},
"config": {
"vendor-dir": "Vendor"
}
}
bootstrap.php (as per Cookbook)
// Load Composer autoload.
require APP . '/Vendor/autoload.php';
// Remove and re-prepend CakePHP's autoloader as Composer thinks it is the
// most important.
// See: http://goo.gl/kKVJO7
spl_autoload_unregister(array('App', 'load'));
spl_autoload_register(array('App', 'load'), true, true);
Run composer install or composer update and you should be good.

Is it normal that zendframework/zend-http package requires 49 components?

Here's the composer.json:
{
"repositories": [
{
"type": "composer",
"url": "https://packages.zendframework.com/"
}
],
"require": {
"zendframework/zend-http": "2.*"
}
}
... and the exhaustive list:
Authentication Code Db Escaper Filter InputFilter Log Mime Paginator Server Stdlib Uri XmlRpc
Barcode Config Debug EventManager Form Json Mail ModuleManager Permissions ServiceManager Tag Validator
Cache Console Di Feed Http Ldap Math Mvc ProgressBar Session Test Version
Captcha Crypt Dom File I18n Loader Memory Navigation Serializer Soap Text View
Some of them actually make sense. But what about Barcode,Captcha,Navigation or even Dbfor instance?
Edit
$ rm -rf vendor
$ rm -rf ~/.composer/
$ rm composer.lock
$ more composer.json
{
"require": {
"zendframework/zend-http": "2.*"
}
}
$ composer self-update
You are using the latest composer version.
$ composer install
Loading composer repositories with package information
Installing dependencies
- Installing zendframework/zendframework (2.1.3)
Downloading: 100%
zendframework/zendframework suggests installing doctrine/common (Doctrine\Common >=2.1 for annotation features)
zendframework/zendframework suggests installing ext-intl (ext/intl for i18n features)
zendframework/zendframework suggests installing pecl-weakref (Implementation of weak references for Zend\Stdlib\CallbackHandler)
zendframework/zendframework suggests installing zendframework/zendpdf (ZendPdf for creating PDF representations of barcodes)
zendframework/zendframework suggests installing zendframework/zendservice-recaptcha (ZendService\ReCaptcha for rendering ReCaptchas in Zend\Captcha and/or Zend\Form)
Writing lock file
Generating autoload files
PS: pleased that some consider my question as simply good to be closed ... I really thank the others for having tryed to answer.
It doesn't.
Using that composer.json file, I get this:
$ composer.phar install
Loading composer repositories with package information
Installing dependencies
- Installing zendframework/zend-stdlib (2.1.3)
Downloading: 100%
- Installing zendframework/zend-servicemanager (2.1.3)
Downloading: 100%
- Installing zendframework/zend-filter (2.1.3)
Downloading: 100%
- Installing zendframework/zend-i18n (2.1.3)
Downloading: 100%
- Installing zendframework/zend-validator (2.1.3)
Downloading: 100%
- Installing zendframework/zend-escaper (2.1.3)
Downloading: 100%
- Installing zendframework/zend-uri (2.1.3)
Downloading: 100%
- Installing zendframework/zend-loader (2.1.3)
Downloading: 100%
- Installing zendframework/zend-http (2.1.3)
Downloading: 100%
zendframework/zend-stdlib suggests installing pecl-weakref (Implementation of weak references for Stdlib\CallbackHandler)
zendframework/zend-servicemanager suggests installing zendframework/zend-di (Zend\Di component)
zendframework/zend-filter suggests installing zendframework/zend-crypt (Zend\Crypt component)
zendframework/zend-validator suggests installing zendframework/zend-db (Zend\Db component)
zendframework/zend-validator suggests installing zendframework/zend-math (Zend\Math component)
Writing lock file
Generating autoload files
The full list of dependencies that zend-http has are:
Escaper
Filter
i18n
Loader
ServiceManager
StdLib
Uri
Validator

Resources