I have recently started to learn ZendFramework2 and am at the part where I need to run php composer.phar install to initialize the skeleton application. I've already successfully executed the following instruction:
git clone git://github.com/zendframework/ZendSkeletonApplication.git
I know I have good outbound connectivity. My problem occurs when I get to the part, where I need to install the composer. I get the following output:
rt_zapzap#zingzing1:/var/www/ZendApp$ composer install
Loading composer repositories with package information
Installing dependencies
- Installing zendframework/zendframework (2.2.0rc3)
Downloading: connection...
[Composer\Downloader\TransportException]
The "https://api.github.com/repos/zendframework/zf2/zipball/release-2.2.0rc3" file could not be downloaded (HTTP/1.0 400 Bad Request)
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom- installers] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader]
For reference my composer.json looks like
{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"homepage": "http://framework.zend.com/",
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": ">2.2.0rc1"
}
}
Any idea where I might look to correct this issue?
Related
When running my Electron project normally, like electron ./artist-test-kit-main.js, everything works fine. When I build the project into an executable, attempts to load files start failing, like: Uncaught Error: ENOENT: no such file or directory, open 'asset-editor\data.json' So I ran a test to see if there's a difference in the root directory between the normal (electron ./artist-test-kit-main.js) execution and the .exe's.
Within index.js (launched by index.html, launched by artist-test-kit-main.js which is a standard electron.js initiator file):
console.log(fs.readdirSync('./'))
In the .exe, this outputs:
In the normal dev execution (electron ./artist-test-kit-main.js), this outputs:
This usual root directory of the project is, after being packaged, stored in the resources directory seen in the .exe execution root directory. So now all my file reads seem to be broken because of this discrepancy in root directories.
How can I solve this?
My package.json shows the build arguments used:
{
"name": "app",
"version": "1.0.0",
"description": "",
"main": "artist-test-kit-main.js",
"dependencies": {
...
},
"scripts": {
"start": "electron .",
"start-artist": "electron ./artist-test-kit-main.js",
"build": "electron-packager ./ game --platform=win32 --arch=x64 --overwrite=true",
"build-art": "electron-packager ./ asset-editor --platform=win32 --arch=x64 --overwrite=true"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"electron-packager": "^15.4.0"
}
}
TLDR
Use __dirname instead of .
Explanation
. refers to the current working directory (cwd), which is the directory in which the node process was started.
For an unpackaged app, this is usually the root folder of your project, producing the expected results. For a packaged app, the cwd will likely be where the Electron executable is stored. The app's contents (what was previously the root folder) are put inside resources/app or resources/app.asar relative to the executable.
The way to unify the packaged and unpackaged scenarios is to use __dirname, which contains the directory of the currently running Node script. This way, it will be the same as using . in an unpackaged app, but will return the path with resources/app in the packaged scenario, as that is then the location of the currently running Node script.
This is why you'll often see people using something like `file://${__dirname}/assets/index.html` to address files in Electron.
Side note
If you use require('./file.js'), the path is evaluated relative to the location of the calling script and will work as if you had used __dirname.
I get the following error:
Message:
Unable to find suitable version for underscore
Details:
code: ECONFLICT
picks: [object Object],[object Object],[object Object]
With the following bower file, this error I have never come across before. I cannot use the interactive shell, as this gets deployed to continuous integration. We also prefer to use Github repo links (don't ask me why) over bower packages.
{
"name": "Nightbird",
"version": "0.0.1",
"main": "src/css/style.scss",
"dependencies": {
"backbone": "git#github.com:jashkenas/backbone.git#1.1.2",
"underscore": "git#github.com:jashkenas/underscore.git#1.6.0",
"aisis-bootstrap-theme": "git#github.com:AdamKyle/Aisis-Bootstrap-Theme.git#0.5.0",
"selectize.js": "git#github.com:brianreavis/selectize.js.git#0.8",
"underscore.string": "git#github.com:epeli/underscore.string.git#v2.3.2",
"jquery-bootpag": "git#github.com:botmonster/jquery-bootpag.git#1.0.5",
"underscore.inflection": "git#github.com:jeremyruppel/underscore.inflection.git",
"moment": "git#github.com:moment/moment.git",
"bootstrap-markdown": "git#github.com:toopay/bootstrap-markdown.git#2.5.0",
"markdown-js": "git#github.com:evilstreak/markdown-js.git#v0.5.0",
"to-markdown": "git#github.com:domchristie/to-markdown.git#v0.0.2",
"font-awesome": "git#github.com:FortAwesome/Font-Awesome.git#4.2.0",
"react-bower": "git#github.com:reactjs/react-bower.git#0.11.1",
"showdown": "git#github.com:coreyti/showdown.git#0.3.1",
"pure": "git#github.com:yahoo/pure.git#0.5.0"
}
}
Any idea whats going on? Is this a bug? or just a developer being dumb?
You have a conflict between 3 different versions of underscore.
The reason for this is that underscore is required by 3 of your dependencies: Nightbird, backbone and underscore.inflection.
Using the latest version of Bower you can see the following information:
Unable to find a suitable version for underscore, please choose one:
1) underscore#1.6.0 which resolved to 1.6.0 and is required by Nightbird
2) underscore#>=1.5.0 which resolved to 1.6.0 and is required by backbone#1.1.2
3) underscore#~1.7.0 which resolved to 1.7.0 and is required by underscore.inflection#1.2.0
You can force bower to use a specific version in case of resolution by adding the following to your bower.json. In this example it will force using 1.6.0:
"resolutions": {
"underscore": "1.6.0"
}
Is there any way to install modules by directly downloading from git-hub without php composer.phar. Because my php composer is not working.
this is the error
$ php composer.phar require webino/webino-image-thumb:2.*
./composer.json has been updated
Loading composer repositories with package information
Ignoring unknown parameter "server role"
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Can only install one of: zf-commons/zfc-admin[v0.1.0, dev-master].
- Can only install one of: zf-commons/zfc-admin[v0.1.0, dev-master].
- Installation request for zf-commons/zfc-admin 0.1.0 -> satisfiable by zf-commons/zfc-admin[v0.1.0].
- Installation request for zf-commons/zfc-admin == 9999999-dev -> satisfiable by zf-commons/zfc-admin[dev-master].
Installation failed, reverting ./composer.json to its original content.
My composer.json looks like this:
{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [ "framework", "zf2" ],
"minimum-stability": "dev",
"homepage": "framework.zend.com/",
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.2.0",
"webino/webino-image-thumb": "1.*",
"zf-commons/zfc-admin":"0.1.0"
}
}
There are three ways you can typically install Zend 2 Modules.
Through the file system
Git
Composer
You could just run:
https://github.com/ZF-Commons/ZfcAdmin.git
to get the module. But I am unsure if it is going to work since you likely have a dependency issue that needs resolving. I would recommend sticking with composer. Please post your whole composer.json file and I'm sure that the issue can be solved.
I cannot reproduce your error.
I copy your composer.json file into an empty directory and execute composer install there. Works.
I then issue composer require webino/webino-image-thumb:2.*, and it downloads that version (2.0.0-RC1) just fine.
I have a project that uses bower.
My bower.json:
{
"name": "myproject",
"version": "0.0.0",
"dependencies": {
...
"angular-sanitize": "1.2.1",
...
Then I run bower install.
Then I can see what's installed:
➜ myproject git:(develop) ✗ ls app/bower_components/angular-sanitize/
README.md angular-sanitize.min.js bower.json
angular-sanitize.js angular-sanitize.min.js.map
But then a coworker checkouts the project, he bower installs, on his machine, this dependency is installed in
app/bower_components/angular-sanitize/bower-angular-sanitize-v1.2.1/
instead of my original
app/bower_components/angular-sanitize/.
So why does bower sometimes adds bower-angular-sanitize-v1.2.1/ to the installation folder ?
Notes: We have the same bower.json and version of bower. If I delete my bower_dependencies and reinstall, I still have the old folder.
Edit:
What I understand (after playing a while with bower install a removing bower_components, clearing bower cache etc)...
My problem is linked to how bower resolves resolutions. It seems that versions are resolved once bower prompts you with a choice for choosing a few version (jquery, angular and bootstrap).
But still, a few things that I don't understand:
On my machine, even after removing bower cache, removing bower_dependencies or copying the bower.json in a new folder, bower never prompts me about resolutions after a "bower install" (so how are they stored?)
On my coworker machine, bower prompts for resolutions only on his native system (and not when "bower install"ing in a vagrant machine).
So, I have a few more obscure points:
How does bower store the dependencies resolutions ? Is there documentation about this anywhere ? The only place I have found something is on some github issues (and by playing around with it).
My bower.json:
{
"name": "myproject",
"version": "0.0.0",
"dependencies": {
"json3": "~3.2.4",
"bootstrap-sass": "~2.3.1",
"es5-shim": "~2.0.8",
"angular-cookies": "~1.2.1",
"angular-dragdrop": "<=1.0.4",
"angular-strap": "~0.7.1",
"angulartics": "~0.8.4",
"jquery": "~1.8.3",
"underscore": "~1.4.4",
"angular": "1.2.1",
"angular-route": "1.2.1",
"angular-resource": "1.2.1",
"angular-sanitize": "1.2.1",
"angular-ui-date": "~0.0.3",
"jquery.masonry": "v2.1.08",
"bootstrap": "~2.3.1",
"angular-bootstrap": "~0.10.0",
"highcharts": "~3.0.2",
"jqueryui-timepicker-addon": "~1.4",
"moment": "~2.0.0",
"bootstrap-notify": "0.1.0",
"mjaalnir-bootstrap-colorpicker": "~1.0.0"
},
"devDependencies": {
"angular-mocks": "~1.0.7",
"angular-scenario": "~1.0.7"
},
"resolutions": {
"jquery": "~1.8.3",
"angular": "1.2.1",
"bootstrap": "~2.3.1"
}
}
We have the same problem here - it seems when the resolutions are defined within bower.json on install with empty cache and an empty bower_components directory, the package gets installed into bower_components/package/package-version whereas if you select the resolutions interactively during install, then it gets installed into bower_components/package - so if you hit that problem, clean the cache (e.g. bower cache clean), delete installed components (e.g. rm -rf bower_components/) and remove the resolutions from bower.json and then bower install.
I had the same issue. I had to go trough every dependency and install it separately, check its version and then resolving it's resolution when asked. Once it worked and didn't put the folder with the package version number, then I saved the bower.json with the right version and with the resolution (again, when asked to). It worked for me, now all bower dependencies are versioned, no "*" or "latest", and some even without the "~" at the beginning of the version.
Hope this helps you and everyone facing this problem.
when you use the zend skeleton to start your new project and composer to install packages it recommends this:
"doctrine/common": "Doctrine\\Common >=2.1 for annotation features",
"ext-intl": "ext/intl for i18n features",
"pecl-weakref": "Implementation of weak references for Zend\\Stdlib\\CallbackHandler",
"zendframework/zendpdf": "ZendPdf for creating PDF representations of barcodes",
"zendframework/zendservice-recaptcha": "ZendService\\ReCaptcha for rendering ReCaptchas in Zend\\Captcha and/or Zend\\Form"
I could install the zendpdf, zendservice-recaptcha and doctine/common package but not the PECL ones.
I think it's a little sad that zf2 suggest the packages, but leaves users alone with, how to properly configure the composer.json.
I heard composer could also get PECL packages, but couldn't find any documentation on it.
How do I install them?
To install the suggested packages, modify composer.json to include them.
"repositories": [
{
"type": "composer",
"url": "http://packages.zendframework.com/"
}
],
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.*",
"doctrine/common": "dev-master",
"zendframework/zendpdf": "2.*",
"zendframework/zendservice-recaptcha": "2.*"
}
Then run
php composer.phar update
Note: that composer installs doctrine/common by using
git clone http://github.com/doctrine/common
On Windows git needs to be in your PATH environment variable.
Regarding ext/intl, this extension is bundled with PHP as of PHP version 5.3.0. and can be found in the ext/ folder of your php installation.[1]
To enable, uncomment (remove the semi-colon before the directive) it in php.ini
extension=php_intl.dll
Regarding pecl-weakref, this is also a PHP extension however this is not bundled with php and needs to be installed. More information on how to do that can be found at http://php.net/manual/en/install.pecl.php
A DLL for this PECL extension is currently unavailable. See also the
building on Windows section. [4]
[1] http://php.net/manual/en/intl.requirements.php
[2] http://php.net/manual/en/weakref.installation.php
[3] http://php.net/manual/en/install.pecl.intro.php
[4] http://php.net/manual/en/install.pecl.windows.php