I'm developing a front-end package and this is my environment:
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\gulp\bin\gulp.js" %*
) ELSE (
node "%~dp0\..\gulp\bin\gulp.js" %*
It's not optimal but here's what I ended up doing: I used a NuGet package for setting environment variables in MSBuild and created the following build configuration:
<Target Name="GulpBuild"> <SetEnvVariable Name="path" Value="%path%;..\packages\Node.js.5.3.0" /> <Exec Command="node_modules/.bin/gulp" /> </Target>
Now when I build the solution in VS (CTRL+Shift+B) it adds the node location to the path and then calls gulp. Of course I guess I could have just written the gulp command myself including the node path. In any case, this is of course not optimal because I need to manually update the location if I update the Node.js version, but I couldn't find any better solution.
At least the path configuration is defined inside the repository and does not depend on any machine configuration.