I'm trying to set up an automated package build for an app which uses bower. When it gets to bower install in the postinstall, bower prompts:
[?] May bower anonymously report usage statistics to improve the tool
over time? (Y/n)
This is screwing up the automated scripts. I could write an expect script to deal with this but I'd rather not if I don't have to. Is there a way to get it to shut up?
As was noted in a comment, this was raised as an issue at github. At the end of that issue there's reference to a minor note at the end of the CHANGELOG comments:
NOTE: It's advisable that users use --config.interactive=false on automated scripts.
You can create a ~/.bowerrc file, which is useful when using bower to install components in a Docker environment:
{
"interactive": false
}
Another option is setting an environment variable (source):
export CI=true
It seems that you could use
bower --config.analytics=false install
to disable only Analytics question.
#see https://github.com/bower/bower/pull/1470
In addition to the existing answers, note that when you are running bower from grunt (e.g. with grunt bower-install-simple, you'll have to add this not into any .bowerrc file, but into the Gruntfile.js. I recently added this line to prevent our CI getting stuck due to unresolvable dependencies:
grunt.initConfig({
...,
/**
* Downloads and installs library dependencies via bower
* defined in bower.json.
*/
'bower-install-simple': {
options: {
...,
+ interactive: false
}
}
});
General way to bypass input for most commands: yes.
yes | bower install
yes | grunt build
Related
CAVEAT: If you would like to use Serverless Framework with Nix/NixOS, this is not the way to do it: the package you end up with is outdated, and (as stated below) it probably won't work anyway. See thread on NixOS Discourse.
Wanted to try out Serverless via nix-shell so I looked it up, ran the command
nix-shell -v -p nodePackages.serverless
a̶n̶d̶ i̶t̶ w̶o̶r̶k̶s̶ f̶l̶a̶w̶l̶e̶s̶s̶l̶y̶.1
What makes this possible without requiring me to install Node manually to be able to run npm install -g serverless? (E.g., Is the node_modules folder somewhere in the Nix store? What happens if I nix-shell another Node package - will they share that same directory?)
[1]: It does not... See this Reddit thread; probable setuid issue. Still interested in the behind the scene stuff though.
This question is more like a todo because I really would like to figure it out myself but don't have the time for it right now...
This is possible because it was packaged with node2nix. This tool generates expressions that fetch the various packages and put them in a node_modules directory.
Indeed it's not perfect and some package need some extra fixing up to make them work well. The node2nix tooling could 'learn' from the cabal2nix integration in Nixpkgs to improve the quality of packaging and the Nixpkgs developer experience.
I would like to utilize pipenv as my virtual environment manager and for my dependency management for my Python cdk projects, upon running 'cdk init'. I read that you can specify a 'custom' application template but could not find documentation on creating one. Is it possible and can the virtual environment/dependency manager be controlled using this feature?
I would like to be able to run 'cdk init hello-world --language python' and have the scaffolding for the project be generated BUT using pipenv.
It's not possible to do that without modifying the source code for the CDK package itself. You likely won't want to manage your own divergent version of the standard package.
I've shoe-horned CDK to work with PipEnv a couple of times, and it's more work than it's worth at this point. The problem is that PipEnv forces the . delimiter in the package name to a -; pipenv install aws-cdk.aws-rds is listed as aws-cdk-aws-rds in the Pipfile, and the package installations don't actually work.
There's an open issue on the repo for this though (https://github.com/aws/aws-cdk/issues/3671), so you could +1 there in hopes that they can address it. It really is an issue with Pipenv though.
Following the link from Scott for the open issue, it looks like this works now, provided the package name is in quotes.
I got the CERT_UNTRUSTED when I tried to run bower install command to install components.
For example, I got this error when I ran the following:
bower install bootstrap-sass-official --save
The output was:
bower error Request to https://bower.herokuapp.com/packages/bootstrap-sass-official failed: CERT_UNTRUSTED
Note: This is not a package specific error. This happens when you try to install any package, not just with bootstrap-sass-official.
you can try setting this in .bowerrc:
{
"directory": "bower_components",
"registry": "http://bower.herokuapp.com",
"strict-ssl": false
}
I found a quick fix for this issue. I guess the issue is happening because of my company's SSL settings.
I changed the registry search as follows (in my windows laptop) and it fixed the issue.
set registry.search=http://bower.herokuapp.com
This should work in unix systems as well, where you have to create a env variable with above key and value.
You can also change the registry setting at .bowerrc file.
You can follow as a quick and dirty fix. Do not make it as a permanent solution.
can you define the working directory for bower? or tell it where I want the install to run at? ie: like the composer working directory flag?
--working-dir (-d) If specified, use the given directory as working directory.
EDIT: Bower now supports config.cwd http://github.com/bower/spec/blob/master/config.md#cwd
bower install jquery --config.cwd=~/my-sub-project
It seems to be an option in bower canary but not currently supported in stable bower yet according to bower contributor [stazor][1]
With bower-canary you have the ability to specify --config.cwd and
--config.directory.
When released it will work like this
bower install jquery --config.cwd=client
https://github.com/bower/bower/issues/212
Working directory for bower is in file
.bowerrc
in the following format
{
"directory": "resources/assets/bower"
}
Bower uses the current working directory. Just cd into the directory you want. No need for an option.
This is a follow-up to this question. I'm using bower 0.7.1, and still cannot get the components to be installed anywhere else than in the components folder.
I tried adding the following line to my component.json, as per this PR:
"componentsDirectory": "public/components"
But it will still install in ./components.
I tried to create a .bowerrc file next to component.json:
{
"directory" : "public/components"
}
But I get this error when running bower install:
Error: Unable to parse local .bowerrc file: Unexpected token }
Any idea?
Actually the .bowerrc file does work, this was an issue with my IDE not saving the file properly:
{
"directory" : "public/components"
}
I'm still wondering why componentsDirectory still doesn't work in component.json, though.
While you can happily use Bower to manage the dependencies of your own personal projects, primarily the component.json is a description of your project for other people. If you share a component through the Bower registry the component.json goes with it to describe the dependencies. That is why your own local preferences like where to install components don't belong in there.
Another way to change installation directory temporarily is using --config option in command line:
bower install jquery --config.directory=/path/to/your/components
If you are creating this file in Notepad++, make sure the Encoding is set to "Encode in UTF-8 without BOM" and save as file type "Any".