I try to publish my Sitecore project solution using a custom-made script. I run the gulp publishSitecoreSolution command (a custom-made one), and I get this output in PowerShell:
[15:55:04] Loading C:\users\USERNAME\source\repos\PROJECT_FOLDER\sitecore-training-project\gulpfile.js\tasks\publishProject.js
[15:55:04] Using gulpfile C:\users\USERNAME\source\repos\PROJECT_FOLDER\sitecore-training-project\gulpfile.js
[15:55:04] Starting 'publishSitecoreSolution'...
publish starting
publish starting
publish starting
publish starting
publish starting
publish starting
publish starting
publish starting
[15:55:08] 'publishSitecoreSolution' errored after 3.88 s
[15:55:08] Error: spawn C:\windows\microsoft.net\Framework64\v(not used)\msbuild.exe ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
at onErrorNT (internal/child_process.js:467:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
There are but a few threads on the internet dealing with this, like the one here Issue while Setup Habitat 1.8.1 on Sitecore 9.2 "Error: spawn C:\Windows\microsoft.net\Framework64\v(not used)\msbuild.exe ENOENT". It's similar, but not the same.
So far I tried looking through the registry, after that looking at folder contents in the path outlined in error text (screenshot below),
then I tried logging whatever I could in the gulpfile, such as the contents of the msbuild object, and here's what console.table(msbuild) gives
I'm including the code snippet where the msbuild object I'm logging is defined and where the function publishSitecoreSolution that is executed by gulp is defined:
var gulp = require("gulp");
var _msbuild = require("msbuild");
var argv = require("yargs").argv;
var glob = require("glob");
function publishProject(src, publishProfile){
var msbuild = new _msbuild();
msbuild.sourcePath = src;
msbuild.version = $.config.msBuildVersion;
msbuild.overrideParams.push("/p:PublishProfile=" + publishProfile);
msbuild.publish();
};
async function publishSitecoreProject(){
var src = argv.layer + "/" + argv.name + "/code/*.csproj";
var publishProfile = (argv.publishProfile === undefined) ? "Default" : argv.publishProfile;
var filePath = glob.sync(src)[0];
if(filePath != "undefined"){
publishProject(filePath, publishProfile);
} else{
console.log("Project does not exist!");
}
};
async function publishSitecoreLayer(){
var src = argv.layer + "/**/code/*.csproj";
var publishProfile = (argv.publishProfile === undefined) ? "Default" : argv.publishProfile;
var filePathes = glob.sync(src);
if(filePathes.length > 0){
filePathes.forEach(async function(filePath){
publishProject(filePath, publishProfile);
});
} else{
console.log("Layer does not exist or empty!");
}
};
async function publishSitecoreSolution(){
var src = "./**/**/code/*.csproj";
var publishProfile = (argv.publishProfile === undefined) ? "Default" : argv.publishProfile;
var filePathes = glob.sync(src);
if(filePathes.length > 0){
filePathes.forEach(async function(filePath){
publishProject(filePath, publishProfile);
});
} else{
console.log("Layer does not exist or empty!");
}
};
gulp.task("publishSitecoreProject", publishSitecoreProject);
gulp.task("publishSitecoreSolution", publishSitecoreSolution);
gulp.task("publishSitecoreLayer", publishSitecoreLayer);
I've the latest .NET SDK installed.
I simply don't know where to look or what to do anymore. Any help is appreciated! Thanks-
npm
are you using? Can you also list your dependencies inpackage.json
? If I recall correctly, this can happen due to version issues withnpm
and/or a subdependency of a module. Once you add a bit more info I should be able to help.