I have a project which uses a gulpfile.js, and have set it to run gulp before build:
<Target Name="GulpBuildDevelop" BeforeTargets="BeforeBuild" Condition="'$(Configuration)'=='Develop'">
<Exec Command="npm install gulp" />
<Exec Command="gulp build-development" />
</Target>
<Target Name="GulpBuildUAT" BeforeTargets="BeforeBuild" Condition="'$(Configuration)'=='UAT'">
<Exec Command="npm install gulp" />
<Exec Command="gulp build-release" />
</Target>
<Target Name="GulpBuildRelease" BeforeTargets="BeforeBuild" Condition="'$(Configuration)'=='Release'">
<Exec Command="npm install gulp" />
<Exec Command="gulp build-development" />
</Target>
I am building using MSBuild on the Jenkins server, running on push. All the projects are on the same server, just different directories. In UAT and Release everything runs as expected:
GulpBuildRelease:
npm install gulp
up to date, audited 959 packages in 3s
62 packages are looking for funding
run `npm fund` for details
11 vulnerabilities (1 moderate, 8 high, 2 critical)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
gulp build-development
[[90m10:51:43[39m] Using gulpfile C:\Program Files (x86)\Jenkins\jobs\Records.calfee.com-Live\workspace\ApplicationUI\gulpfile.js
[[90m10:51:43[39m] Starting 'build-development'...
[[90m10:51:43[39m] Starting 'js-vendor-dev'...
...[abbreviated]...
[[90m10:51:54[39m] Finished 'css-vendor-dev' after 11 s
[[90m10:51:54[39m] Finished 'kendo-vendor-dev' after 11 s
[[90m10:51:54[39m] Finished 'js-app-dev' after 11 s
[[90m10:51:54[39m] Finished 'build-development' after 11 s
However, in the Develop branch, the install runs differently and it errors saying it cannot run gulp:
GulpBuildDevelop:
npm install gulp
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
npm notice save gulp is being moved from devDependencies to dependencies
npm WARN Invalid version: "1.0.0.0"
npm WARN ApplicationUI No description
npm WARN ApplicationUI No repository field.
npm WARN ApplicationUI No README data
npm WARN ApplicationUI No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\sass\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ [email protected]
updated 1 package and audited 1421 packages in 4.453s
found 10 vulnerabilities (5 moderate, 4 high, 1 critical)
run `npm audit fix` to fix them, or `npm audit` for details
gulp build-development
'gulp' is not recognized as an internal or external command,
operable program or batch file.
I have tried running npm install -g gulp, tried specifying the working directory, nothing has worked.