I have been using CoffeeScript files within a project and have installed grunt into the project to compile them.
I am using Grunt Launcher to compile the files manually, but I wanted to be able to do so automatically when the project is built. To this end I put the following in the pre-build event command line under the project properties:
CD $(ProjectDir)
grunt build
This seems to work locally, but when I commit to the build server it comes back with this error:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1063,5): error MSB3073: grunt build" exited with code 9009
My research suggest that this is essentially a file not found; I presume for grunt. Some posts (here and here) suggest that added the full path is the answer, but what is the full path for grunt? Is it something like:
"path-to-project\node_modules\grunt\lib\grunt.js"
Grunt is installed both locally in the project and globally on my PC. I'm using Visual Studio 2012.
Is there anyway to get the build server to run grunt?
Thank you in advanced for any help.
Thank you to anyone who had a look at this question.
After a bit of experimenting I found putting this into the pre-build event command line works:
CD $(ProjectDir)
cmd.exe grunt build
Related
I'm currently porting a fully working Windows project to an Ubuntu system. After doing the installation of apache/php/mysql/composer/nodejs/nmp I try to run the project. I got the directory where the sources are located (in the web servers location) and I do composer install and the nmp install and they all finish without a flaw. The last step is to call gulp. When I do, I get several of the following errors:
gulp-notify: [Laravel Elixir] Browserify Failed!: Cannot find module
'./components/Colegiados/pagosMatricula/index.vue' from
'/home/web/martilleros/resources/src'
However, the files are there at the specified location. So what am I doing wrong?
I am attempting to set up a xcode project and bot that will build a nodejs application on commit from a github repository and restart the server after the build completes. The bot is currently picking up on the repository changes but fails to build correctly.
I am using a xcode external build tool project that uses /bin/bash as the tool path and the working directory is set to the local repository path.
The bot's after integration script is something like,
npm install --production
npm run build
npm run server:restart
I am getting errors like [npm|node] is not recognized.
Just looking for some clarity to what I might be missing or what could be going wrong.
Add this to the beginning of your script and review the output:
which node
set | grep PATH
This will happen if node is not in your path, which may happen because build scripts have a pretty basic environment - they're not running as a normal user. You may need to add it to your PATH at the start of your build script.
Can anyone let me know how the build definition for a node.js application should look like? Also how to mention the mocha tests in the Automated tests?
First time when I tried to queue a build, I got an error saying:
Microsoft.NodejsTools.targets not found.
So I went and copied the NodejsTools folder with the .target and dll file in my build server. And I didn't see the error.
Now I get the below error:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets (132): Could not copy the file "obj\Debug\OstNodeJs.exe" because it was not found.
You need the node.js framework and the Visual Studio node.js Tools on you build server, too. You just copied the necessarily files and this may result in other problems.
For the executable copy problem you can try to add <Disable_CopyWebApplication>True</Disable_CopyWebApplication> in the project file. See here: Build on TFS wants to copy a executable from Node.js test project
I've installed gulp and it works well in my cmd. So when I'm trying the gulp commands they work well. So I'm going to this path in my cmd:
C:\Program Files (x86)\Jenkins\workspace\project1
And I can run gulp (its a github project on my Jenkins).
But when I'm working on my project1 in Jenkins itself (localhost), the gulp commands aren't recognized. Jenkins doesn't know gulp.
How do I have to integrate gulp in Jenkins? So my Jenkins will know its commands. I read something about node.js and its pluging.
I also read something about a frontend-maven-plugin/
but it isn't clear at all.
You need to add the gulp path for Jenkins so it knows where the command resides.
Manage Jenkins-->Configure System-->Global Properties:
If you have gulp defined as your project's dependency then you can also use it directly:
node_modules\.bin\gulp mytask
I've set up a jenkins CI server on a windows box for one of my projects. There is a portion of it written in Coffeescript. Previously this part wasn't looped into the build process. Now It needs to be.
I haven't seen any coffeescript plugins for jenkins, or much from google on the topic of building coffeescript in jenkins.
I am looking for the simplest way to set up a jenkins build to include a coffee compilation step. Preferably through plugins on jenkins rather then manually installing programs on the box.
Currently the coffeescript is compiled via commands like so
coffee --lint --watch --output "C:\repositories\martha\trunk\bb\app\bin\js/" --compile "C:/repositories/martha/trunk/bb/app/src/"
in the Node.js command prompt on developing boxes
I've also noticed that Jenkins has a node.js plugin where you are capable of running scripts in a build step. I don't believe I can use the commands npm install -g coffee-script or coffee --compile through node.js scripts rather then the command line. Though I hope I am wrong.
Currently the best option I see is to install node.js on the box, use npm to install coffee script, and then run batch scripts as a build step. Though I am willing to pursue this, I would like less manual installation on the box, to ease the use of coffee-script in more projects.
Is this my best option?
Worth saying though I use node.js to compile coffee-script, node.js itself, and its capabilities, are very new to me.
One possible solution is to run the compiler with the script provided in extras/coffee-script.js. You have to use JDK 7 or the latest Rhino (JDK 6 will not work). Here is a link to a simple CoffeeScript compiler in Java
i would recommend
a) installing nodejs plugin + grunt on jenkins -> Jenkins integration with Grunt
b) voting up the excellent instructions :)
c) then using grunt to compile the coffee script, this also means you can easily locally compile coffee script too!!
grunt instructions -> http://gruntjs.com/
grunt coffee script instructions -> https://github.com/gruntjs/grunt-contrib-coffee
basically you need a Gruntfile.js a bit like this
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
coffee: {
compile: {
files: {
'path/to/result.js': 'path/to/source.coffee', // 1:1 compile
'path/to/another.js': ['path/to/sources/*.coffee', 'path/to/more/*.coffee'] // compile and concat into single file
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.registerTask('default', ['grunt-contrib-coffee']);
};
then for the jenkins shell task you just need this, to run grunt and hence coffee script
npm update
grunt