This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Producing a working SpaServices NuGet package #261
Copy link
Copy link
Closed
Description
I am unable to create a working NuGet package for SpaServices locally on my Windows machine (tried dev and master branches). Following a dotnet restore, I am running the following from both NodeServices and SpaServices directories.
dotnet pack -c Release --version-suffix custom-1 -o /c/dev/nugetIn my project, SpaServices will successfully upgrade from the official package to my custom version (with as yet unchanged source), however the next dotnet run fails at UseWebpackDevMiddleware() with the exception below. I've checked my cache in ~/.nuget and everything appears to be in order with the package.
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AggregateException: One or more errors occurred. (Call to Node module failed with error: Error: Cannot find module 'C:\Users\Matt\AppData\Local\Temp\tmp2C5.tmp'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at C:\Users\Matt\AppData\Local\Temp\tmp382.tmp:104:34
at IncomingMessage.<anonymous> (C:\Users\Matt\AppData\Local\Temp\tmp382.tmp:128:35)
at emitNone (events.js:86:13)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:973:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)) ---> System.Exception: Call to Node module failed with error: Error: Cannot find module 'C:\Users\Matt\AppData\Local\Temp\tmp2C5.tmp'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at C:\Users\Matt\AppData\Local\Temp\tmp382.tmp:104:34
at IncomingMessage.<anonymous> (C:\Users\Matt\AppData\Local\Temp\tmp382.tmp:128:35)
at emitNone (events.js:86:13)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:973:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.<InvokeExportAsync>d__7`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.<InvokeExportAsync>d__12`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.<InvokeExportWithPossibleRetryAsync>d__9`1.MoveNext()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Microsoft.AspNetCore.Builder.WebpackDevMiddleware.UseWebpackDevMiddleware(IApplicationBuilder appBuilder, WebpackDevMiddlewareOptions options)
at Trainline.ContactCentre.Host.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.Internal.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at Trainline.ContactCentre.Host.Program.Main(String[] args)
From Startup.cs:
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
{
HotModuleReplacement = true,
ReactHotModuleReplacement = true
});My packages.json:
{
"version": "0.1.0",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"dependencies": {
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.SpaServices": "1.0.0-custom-1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0"
},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
},
"imports": "dnxcore50"
}
}
}Metadata
Metadata
Assignees
Labels
No labels
Activity
SteveSandersonMS commentedon Aug 15, 2016
I'm not sure what technique you're using to get your project to reference your custom-built SpaServices package, but my guess is that something must be set up incorrectly with that.
If you want to run with a custom-modified dependency, I'd suggest this technique to make it build the dependency from source: http://stackoverflow.com/a/29260539. This way there's no need to hack around with your
~/.nugetdirectory. This is how the JavaScriptServices repo itself it set up so that when editing samples (etc) it loads NodeServices/SpaServices/etc directly from source and there's no need to build them manually.If you then want to distribute your custom SpaServices package, you can of course give it some distinct name and publish to any NuGet service.
mattwcole commentedon Aug 15, 2016
Thanks for the help, looks like that will do the trick!