angularjs: can't install angular-cookies to my project - angularjs

I my project I came into an issue about the package of angular-cookies.
I have download the package and place it in my project. And as usually, in index.html, I add a script tag:
<script src="vendor/angular-cookies/angular-cookies.min.js" charset="UTF-8"></script>
But when the pages loaded I got an error message:
Uncaught TypeError: c.module(...).info is not a function at angular-cookies.min.js:7
in the package, it uses angular.module.info but it is not regarded as a function?
So what is the reason for this issue? Is it because version issue? Any help

I had the same problem with a recent bower update I've done. I don't know if the angular 1.6.3 is stable so I went to https://code.angularjs.org/latest/ and I saw that is 1.5.8 angular version which is used.
So to resolve it, I added these versions in my bower.json :
"dependencies": {
"angular-cookies": "1.5.8",
},
"resolutions": {
"angular": "1.5.8"
}

You should install particular dependecies according to angular.You can achieve it by using bower install like this:
bower install angular-cookies#1.5.8
bower install angular#1.5.7

Related

ReactJs - Compiled with warning

Warning
(6:29521) autoprefixer: Replace color-adjust to print-color-adjust. The color-adjust shorthand is currently deprecated.
Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.
WARNING in ./node_modules/bootstrap/dist/css/bootstrap.min.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/bootstrap/dist/css/bootstrap.min.css)
Module Warning (from ./node_modules/postcss-loader/dist/cjs.js):
I encounter this warning while running react-bootstrap(v2.3.1 (Bootstrap 5.1)) with reactjs(v18.1.0). How to solve the problem?
You can add it into package.json
First Step
"resolutions": {
"autoprefixer": "10.4.5"
},
Second Step
yarn install
** If you are using npm
First Step
"overrides": {
"autoprefixer": "10.4.5"
},
Second Step
npm install
** Summarize from https://github.com/twbs/bootstrap/issues/36259#issuecomment-1114855186
Bump bootstrap to 5.2.0 or newer.
Bootstrap 5.1.3 still has this problem.
As I'm typing this, the latest bootstrap 5.2.0 version is 5.2.0-beta1, which given its beta status may or may not be something you want to upgrade to, but upgrading to that will at least solve this problem.
The root cause here is that bootstrap generates CSS with deprecated tags. Notice how your error message implicates bootstrap:
WARNING in ./node_modules/bootstrap/dist/css/bootstrap.min.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/bootstrap/dist/css/bootstrap.min.css)
This problem still exists for me even upgrading to bootstrap 5.2.0-beta1 and upon inspection of the installed bootstrap it appears to be using latest autoprefixer. I see no solution currently. If there is a way to create a js/tsx file to override that would be nice.
Simply setting overrides didn't work for me. I had do go through the following steps :
Add this to package.json:
"overrides": { "autoprefixer": "10.4.5" }
Delete package-lock.json
Delete the node_modules/ directory
Run npm install to install the npm modules back
Go to bootstrap.css or bootstrap.min.css, in my case is bootstrap.min.css
ctrl+F or find text -webkit-print-color-adjust:exact;color-adjust:exact
change the color-adjust to print-color-adjust
problem solved

Why is bower not using my bower.json resolutions?

I have a project I need to use angularjs 1.2 with. I have a bower.json file with the following:
{
"name": "myproject",
"dependencies": {
"angular": "1.2.32"
},
"resolutions": {
"angular": "1.2.32"
}
}
When I install angular it asks me which version I want, although it should not if I understood correctly. And when I try to install another project like angular-route it asks again and even installs the wrong one:
bower install angular-route
bower angular-route#* cached https://github.com/angular/bower-angular-route.git#1.6.4
bower angular-route#* validate 1.6.4 against https://github.com/angular/bower-angular-route.git#*
bower angular#1.6.4 cached https://github.com/angular/bower-angular.git#1.6.4
bower angular#1.6.4 validate 1.6.4 against https://github.com/angular/bower-angular.git#1.6.4
Unable to find a suitable version for angular, please choose one by typing one of the numbers below:
1) angular#1.2.32 which resolved to 1.2.32 and is required by angamcharts2
2) angular#1.6.4 which resolved to 1.6.4 and is required by angular-route#1.6.4
Prefix the choice with ! to persist it to bower.json
? Answer !1
bower angular resolution Saved angular#1.2.32 as resolution
bower angular-route#^1.6.4 install angular-route#1.6.4
angular-route#1.6.4 bower_components/angular-route
└── angular#1.2.32
I know there is angular-route 1.2.32 but I don't want to install all my packages by hand with the correct version. Why is the "resolutions" not working?

typings.json not getting updated typings install --ambient

I used to work with tsd for managing my type definitions, but as it's deprecated, I'm trying to migrate to typings which is my opinion more complicated, but should be the way to go, I guess.
I want to install a type definition and for that I use the --ambient flag.
In Visual Studio I have the typings.json file which looks like that:
{
"name": "Test",
"version": false,
"ambientDependencies": {
"angular": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular.d.ts#ca92a5b250433c38230b5f4138b36453862342bf",
"jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#ca92a5b250433c38230b5f4138b36453862342bf"
}
}
This was automatically created when migrating from tsd to typings but now once I need a new type definition, for instance angular-route I use the following command:
typings install angular-route --ambient
This works fine, but the typings.json does not get updated.
What is the point and why am I missing? Why were angular and jquery both migrated to typings.json and when installing angular-routethe file does not get refreshed?
Actually in Typings 1.0 they did some breaking changes.
"ambient" is now "global". Just in case, installing from DefinitelyTyped must be explicit.
The following will install jQuery and save it to typings.json
typings install dt~jquery --global --save
See the link in Igor's answer for more info
You forgot --save
typings install angular-route --ambient --save
command syntax above is now obsolete and only applicable to version 0.x
Link to Typings command help
Update
As pointed out by #AndresM there are breaking changes in going from version 0.x to 1.x. See the documentation Updating From 0.x to 1.0?. The command syntax in #AndresM answer is the correct way to execute a typings command using DefinitelyTyped store and Typings version 1.x.
Now with Typescript2.0(https://blogs.msdn.microsoft.com/typescript/2016/09/22/announcing-typescript-2-0/) the global is also gone. The following will install jQuery and angular typings:
npm install --save #types/angular #types/jquery
Your package.json will then have:
"dependencies": {
"#types/angular": "^1.5.16",
"#types/jquery": "^2.0.33"
}
Your node_modules directory will have #types/angular and #types/jquery directories which contain index.d.ts files.

Bower install unstable release (1.4.0-rc.0) of angular

Having trouble installing angular#1.4.0-rc.0 via bower - when I run:
bower install --save angular#1.4.0-rc.0
I get the error
no matches found: angular#1.4.0-rc.0
However running bower update angular shows packages that depend on 1.4.0-rc.0:
angular-cookies#1.4.0-rc.0 depends on angular#1.4.0-rc.0 which resolved to angular#1.4.0-rc.0
Adding "angular": "~1.4.0-rc.0" or "angular": "1.4.0-rc.0" doesn't help either!
Thanks guys!
delete your previous bower_components folder or your custom location.
Thanks to #nitin, deleting my bower_components folder and reinstalling did the trick.

Bower install anuglar-module is installs angular instead?

I am trying to install this angular module (angular-stripe). When I type bower install angular-stripe (as the docs recommend) I get:
bower angular-stripe#* cached git://github.com/bendrucker/angular-stripe.git#4.1.0
bower angular-stripe#* validate 4.1.0 against git://github.com/bendrucker/angular-stripe.git#*
bower angular-cookies#~1.3.11 cached git://github.com/angular/bower-angular-cookies.git#1.3.12
bower angular-cookies#~1.3.11 validate 1.3.12 against git://github.com/angular/bower-angular-cookies.git#~1.3.11
bower angular#1.3.12 cached git://github.com/angular/bower-angular.git#1.3.12
bower angular#1.3.12 validate 1.3.12 against git://github.com/angular/bower-angular.git#1.3.12
Unable to find a suitable version for angular, please choose one:
1) angular#1.3.11 which resolved to 1.3.11 and is required by angular-animate#1.3.11, angular-cookies#1.3.11, angular-mocks#1.3.11, angular-resource#1.3.11, angular-route#1.3.11, angular-sanitize#1.3.11, angular-scenario#1.3.11, angular-touch#1.3.11, nightwalker
2) angular#~1.3.2 which resolved to 1.3.11 and is required by angular-stripe#4.1.0
3) angular#1.3.12 which resolved to 1.3.12 and is required by angular-cookies#1.3.12Prefix the choice with ! to persist it to bower.json
This looks like I am installing angular all over again or something. Is there a way to avoid this?
You need to add the resolution
"resolutions": {
"angular": "~1.3.x"
}
In your bower.json file

Resources