1

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.

solryu
  • 11
  • 5
  • For node modules which come with a CLI you should be able to find a local version of the CLI script in `node_modules\.bin`. Try `path-to-project\node_modules\.bin\grunt build` (I've only tried this in linux environments, so I'm not sure that it will work) – caffeinated.tech Nov 07 '17 at 10:02

1 Answers1

0

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
solryu
  • 11
  • 5