Running Bower from TeamCity? - node.js

I have a team city build on Windows with 3 steps. I would like to include a bower step to install all dependencies from the bower.json in the project rather than checking in the lib folder.
Current steps are:
NPM ( install, install grunt-cli, install grunt)
Grunt
karma
I'm not very familiar with node or teamcity and tried to do the following. In (1) added "install bower". Added a new step after (1) running node.js with "bower --force-latest" but was struggling with various errors. Please can someone give me a step by step explanation of how to get bower running or whether I should?

Figured it out:
1) installed grunt and bower onto the server
2) updated the PATH environment variables to include bower
3) rebooted the build box
4) added a command line build step running bower from the correct project working directory: bower install -f
it works! all bower packages installed. karma unit tests then work without moaning about dependencies! I can now remove the lib folder from the commit...

Related

Setting Up Node & NPM

I have installed MEAN IO a few times. Everytime I get it installed I can usually get one project going and then things just stop working. For example I have one project going. But then when I go to create a new project now it says commands are not found
gulp
mean init myApp
bower
So I installed with the installer at https://nodejs.org/en/
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
I have node_modules at
usr/local/lib/node_modules
But I also have packages at
/usr/local/bin/
Either way I cant get these commands to run... Any ideas how I can get things setup and solid?
Try installing mean-cli, bower and gulp globally, like so:
npm install -g mean-cli bower gulp

"grunt install" returns error on Ubuntu

I get the following error when I try to run "grunt install" on a Ubuntu 14.04 box that has the latest nodejs installed from NodeSource.
jit-grunt: Plugin for the "install" task not found. If you have
installed the plugin already, please setting the static mapping. See
https://github.com/shootaroo/jit-grunt#static-mappings
Warning: Task "install" failed. Use --force to continue.
Aborted due to warnings.
Here is the part of Gruntfile.js related to jit-grunt:
require('jit-grunt')(grunt, {
express: 'grunt-express-server',
useminPrepare: 'grunt-usemin',
ngtemplates: 'grunt-angular-templates',
cdnify: 'grunt-google-cdn',
protractor: 'grunt-protractor-runner',
injector: 'grunt-asset-injector',
buildcontrol: 'grunt-build-control'
});
Can someone point to the right direction?
What is the grunt install task? Can you please paste your package.json file here so we may see your dependencies?
The reason jit-grunt is outputting that error is because it cannot find a node module folder named grunt-contrib-install, grunt-install, or install, with a tasks/ folder with JS files that register a Grunt task named install.
Do you mean either of these packages? If so, you have to call them via their registered task names:
- https://www.npmjs.org/package/grunt-npm-install – grunt npm-install
- https://www.npmjs.org/package/grunt-auto-install – grunt auto_install
For the grunt-auto-install package, you will need to add it to jit-grunt's static mappings, like you have with grunt-express-server and others.
If it's not the above, apart from "maybe you mistyped?", the only other answer I can offer is similar to the assumption #waqas-ahmed made: that you mean to install dependencies and devDependencies from your package.json file, and that perhaps you mean to call npm install, not grunt install.
Try as below:
1) npm install -g grunt-cli
This will put the grunt command in your system path, allowing it to be run from any directory.
Note that installing grunt-cli does not install the Grunt task runner! The job of the Grunt CLI is simple: run the version of Grunt which has been installed next to a Gruntfile. This allows multiple versions of Grunt to be installed on the same machine simultaneously.
2) npm install grunt --save-dev
The easiest way to add Grunt and gruntplugins to an existing package.json is with the command npm install --save-dev. Not only will this install locally, but it will automatically be added to the devDependencies section, using a tilde version range.
for further assistance follow this link
http://gruntjs.com/getting-started

How to install the Grunt task runner?

I am trying to install Grunt (on Windows).
The documentation (http://gruntjs.com/getting-started) says to install grunt-cli and explains that this is not the Grunt task runner but just the program to allow the grunt command to be run from any folder. Ok. Fine. I've done that. My next question is; how to install the Grunt task runner. The implication of the docs is that this will be installed locally in my project directory.
How do I do that?
The project already has a Gruntfile.js and a package.json & works on another machine. I'm just trying to get it run locally.
Specifically I get this message:
"... a Gruntfile wasn't found or Grunt hasn't been installed locally to your project"
Thanks
--Justin Wyllie
npm install --save-dev grunt to install it just like any module and add it to your package.json file as a development dependency.
grunt may also already be listed as a dependency, in which case you may just need to run npm install to install all dependencies.

I'm cloning a repo with Yeoman, what configuration do I need on my computer?

I have cloned a repo that has Yeoman installed.
I installed node, as well as Yeoman npm i -g yo. When I run grunt I get an error stating:
Error: Cannot find module 'load-grunt-tasks'
Warning: Task "default" not found. Use --force to continue.
What else do I need to do to be able to run this repo successfully?
The first time, you have to run npm install.
This will install all the needed dependencies as described in the package.json
Subsequently, if anyone add a new dependency into this file, you will need to run npm install or npm update again.
Actually besides npm, you should also download bower dependencies.
So it's 2-step:
npm install
bower install
If you don't invoke bower application may launch, but later you may encounter problems such as the lack of libraries.

grunt init:node not working

I'm trying to do an intro grunt tutorial. I've installed git, node.js, and grunt globally (or at least I thought I did using: npm install -g grunt (which installs). I then made a quick directory and entered it (mkdir demo, cd demo), but when I type:
> grunt init:node
at the prompt I get the following:
grunt-cli: The grunt command line interface (v0.1.11)
Fatal error: unable to find local grunt
If you're seeing this message, either a Gruntfile wasn't found or hasn't been installed locally to your project. For more information about installing and configuring grunt, please see the Getting Started guide:
http://gruntjs.com/getting-started
Which I've looked at and it says to do what I'm doing and what the tutorial mentions??? Any ideas what I've done wrong? Node.js and Git have been working fine so I can only assume it is grunt or the install that has failed.
Thanks
with grunt you need two elements. a global grunt-cli as you have installed using npm install -g grunt-cli and also a local (to the project) copy of grunt itself. so in the folder of your project install this with npm install grunt --saveDev this will install a local grunt and also add it to your devDependencies in your package.json file. you will also need a Gruntfile.js in the project folder. This is a great write-up http://www.integralist.co.uk/Grunt-Boilerplate.html

Resources