Error installing Yii 2.0 in El Capitan

Hi, i am newbie in Yii.

I am trying to install Yii 2.0 via composer on my iMac 27 inch 2012 with OS X El Capitan (10.11.1)

I have followed the steps as shown from getcomposer.org about installation-linux-unix-osx

and also refer to guide-start-installation from yiiframework.com

After downloading installer then run it from directory /Applications/XAMPP/htdocs

$ sudo chmod 777 installer

$ ./installer

After composer.phar has been created, then i run a command to install the Composer Asset Plugin:

$ php composer.phar global require “fxp/composer-asset-plugin:~1.1.1”

The error message was :

[UnexpectedValueException]

Could not parse version constraint ~1.1.1”: Invalid version string "~1.1.1”"

Is there something missing i’ve done causing this error?

Hope any Guru give me some clue to solve this …

Note:

  1. I have install Netbeans 8.1 with JDK 8

  2. Apache already run using XAMPP

Thanks a lot,

Benny.

Try using just:


composer require fxp/composer-asset-plugin

YES … it works.

But, when i try to continue to create a project :

$ php composer.phar create-project --prefer-dist yiisoft/yii2-app-basic basic

Installing yiisoft/yii2-app-basic (2.0.6)

  • Installing yiisoft/yii2-app-basic (2.0.6)

    Loading from cache

Created project in basic

Loading composer repositories with package information

Installing dependencies (including require-dev)

Your requirements could not be resolved to an installable set of packages.

Problem 1

- yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.


- yiisoft/yii2 2.0.5 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.


- Installation request for yiisoft/yii2 >=2.0.5 -> satisfiable by yiisoft/yii2[2.0.5, 2.0.6].

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:++groups.google.com+d+topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <https:++getcomposer.org+doc/articles/troubleshooting.md> for further common problems.

====

I have seen that error before - but I can’t honestly remember what the solution was … :huh:

I do know, however, that this has always worked for me:


composer global require "fxp/composer-asset-plugin:~1.1.0"

Notice the difference between yours and that: the last digit.

I find that Composer moves in mysterious ways too many times.

Before running that, however, you need to go to the global Composer installation directory and remove the fxp directory.

And probably run a composer global clear-cache just for good measure.

And then install the fxp/composer-asset-plugin using the command above ^

And, to be honest, a regular composer clear-cache (that is: local) seems to solve many, many issues that might arise.

It has saved me from grey hairs many times.

YES, again … it’s work.

  1. removing fxp directory in $home/.composer/vendor

  2. removing previous project directory "basic" in /Applications/XAMPP/htdocs

  3. run : php composer.phar global clear-cache

  4. run : php composer.phar global require "fxp/composer-asset-plugin:~1.1.0"

  5. run : php composer.phar create-project --prefer-dist yiisoft/yii2-app-basic basic

all smoothly done …

Thank you to Jacmoe.

Hello Jacmoe,

I experienced the same error after running the command


php composer.phar create-project --prefer-dist yiisoft/yii2-app-basic basic

I’d type in the same error message but being my first post the systems is not letting my type in links…

I did the steps you suggested (removing fxp directory &amp; previous project directory. composer global clear cache and installed the 1.1.0 version of the asset plugin.

Any suggestions?

Much appreciated

You need at least version 1.1.1 1.1.3 :)

Just in case - with latest composer version I’ve got an error. Solution was to --rollback composer selfupdate, install composer-asset-plugin v1.1.3, then composer selfupdate and finally composer update.

Thanks for your reply Jacmoe,

Unfortunately using 1.1.1 also leads to the same error

If this helps, I’m on a fresh installation of Mac OSX 10.11 system

Thanks again

Oh, so it’s 1.1.3 now - that asset plugin sure it a pain in the rear. :)

So, I tried version 1.1.3 now and I get these error:

Problem 1

- yiisoft/yii2 2.0.7 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable -&gt; no matching package found.


- yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -&gt; no matching package found.


- yiisoft/yii2 2.0.5 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -&gt; no matching package found.


- Installation request for yiisoft/yii2 &gt;=2.0.5 -&gt; satisfiable by yiisoft/yii2[2.0.5, 2.0.6, 2.0.7].

All help appreciated as always,.