Unable to find suitable version for underscore - bower

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"
}

Related

Twilio 'Header' import issue

When i installed latest twilio's version which is "twilio": "^4.7.2", and building the project (npm run build) the following error occurs,
node_modules/twilio/lib/base/BaseTwilio.d.ts:22:19 - error TS2304: Cannot find name 'Headers'.
22 headers?: Headers;
~~~~~~~
Found 1 error in node_modules/twilio/lib/base/BaseTwilio.d.ts:22
My node version : v16.18.1
Npm version : v8.19.2
I got the same issue once I installed the twilio npm package of the exact same version ^4.7.2. I'm assuming it's some typescript compilation issue. And there is a trick that you can use to make it work.
Add this in your tsconfig.json:
{
"compilerOptions": {
"skipLibCheck": true,
}
}
This will solve your issue, but don't consider it as a fix. It's rather workaround.
P.S. This will also speed up your overall typescript compilation process.

How to fix error TS2339: Property 'tz' does not exist on type 'Moment'?

In rails app, I created frontend app which uses angular. Here I am using moment and moment-timezone like
"moment": "^2.22.2",
"moment-timezone": "^0.5.23",
In timezone.service.ts importing and using like
import * as moment from 'moment-timezone';
import {Moment} from 'moment';
public parseDatetime(datetime:string, format?:string):Moment {
var d = moment.utc(datetime, format);
if (this.ConfigurationService.isTimezoneSet()) {
d.local();
d.tz(this.ConfigurationService.timezone());
}
return d;
}
While running bundle exec rake assets:precompile getting ERROR in src/app/components/datetime/timezone.service.ts(55,9): error TS2339: Property 'tz' does not exist on type 'Moment'. src/app/components/datetime/timezone.service.ts(80,23): error TS2339: Property 'tz' does not exist on type 'typeof moment'.
npm version is 6.4.1
node version is v8.12.0
ruby verson is ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-linux]
Please help me to solve this issue.
I think you need to update your version of moment-timezone. There is a documented bug on 5.28, but since you're using a lower version in might exist there as well.
https://github.com/moment/moment-timezone/issues/906
this states that 5.33 and 5.31 are without error and in a rails app, using moment-timezone 5.40 I am able to us the tz function without error.
ds.tz("America/Chicago")
From my working package.json
"moment": "^2.29.4",
"moment-timezone": "^0.5.40",

bower: no suitable angular version

Maybe I don't understand SemVer syntax or maybe I don't understand bower (I have version 1.4.1), but I have an app whose bower.json is:
{
"name": "MyApp",
"description": "My AngularJS Project....",
"version": "0.0.0",
"homepage": "https://github.com/angular/angular-seed",
"license": "MIT",
"private": true,
"dependencies": {
"angular": "1.3.x",
"angular-route": "1.3.x",
"angular-loader": "1.3.x",
"angular-mocks": "~1.3.x",
"angular-ui-grid": "~3.0.0-rc.20",
"angular-spinkit": "~0.3.3",
"angular-bootstrap": "0.13.0",
"bootstrap": "3.3.4",
"angular-animate": "~1.3.x",
"file-saver.js": "~1.20150507.2"
},
"resolutions": {
}
}**
When I do a 'bower update', it is “unable to find a suitable version for angular”, but I don't understand why not. Here's the output (#1 seems to be the problem):
Unable to find a suitable version for angular, please choose one:
1) angular#>=1.2.16 <=1.3.x which resolved to 1.2.28 and is required by angular-ui-grid#3.0.0-rc.22
2) angular#1.3.16 which resolved to 1.3.16 and is required by angular-animate#1.3.16, angular-loader#1.3.16, angular-mocks#1.3.16, angular-route#1.3.16
3) angular#1.3.x which resolved to 1.3.16 and is required by MyApp
4) angular#>=1.3.0 which resolved to 1.3.16 and is required by angular-bootstrap#0.13.0
5) angular#* which resolved to 1.3.16 and is required by angular-spinkit#0.3.3
So my reading of that output is that all packages would be happy with version 1.3.16 of angular, except for angular-ui-grid (“resolved to 1.2.28”) But why? Isn't 1.3.16 >=1.2.16 <=1.3.x ? And so isn't version 1.3.16 of Angular a suitable version? isn't it the ONLY suitable version? or maybe I'm misunderstanding what bower is trying to tell me.
I do understand that I can select one of the choices and even add a '!' to persist my choice, but I don't understand why a choice is needed.
Thanks
c0bra - thanks for setting up that plunker - it helped me to easily verify what I believe I finally (after lots of digging) determined is the problem:
there seems to be a bug in older versions of semver.js - I traced down, down, down into the code and the <=1.3.x gets morphed into <=1.3.0-0, and that means that 1.3.16 fails that test.
But that bug has been fixed in the NPM-delivered semver module - I was able to use your plunker to demonstrate to myself that 1.3.16 passes the test with 'latest' semver code, just as you set it up, but fails when I switch to older versions of semver (e.g. "^2.3.0", which seems to be what the bower package requires in its packages.json).
But even the latest bower on github seems to have that ^2.3.0 dependency for semver. So I'll see if I can submit a request to whoever maintains bower to get that upgraded. But I do not see much activity on bower/github of late.
In the meantime, I guess I'm stuck with being forced to answer the question above, since I'm using NPM to get bower, I don't think I can easily override it's semver dependency.

installing modules from git zendframework 2

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.

Installing suggested composer packages ZF2 (Zend Framework 2)

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

Resources