Base solution for your next web application
Open Closed

Perform ./refresh.bat in Mac Environment #5812


User avatar
0
mdframe created

I am sure this is documented somewhere or just my lack of knowlege with MacOS but how do I generate the correct service proxies for Mac development like is performed in Windows development. When I perform npm start on my Mac I get service proxy errors and I am sure its due to the differnence.

The actual error is

ERROR is src/app/shared/layout/header.component.ts(243,35): error TS2339: Property 'prepareCollectedData' does not exist on type 'ProfileServiceProxy

I could be confusing two different issues however I am lost at this point as none of the documents show how to perform what I suspect may be the issue.

Thanks.


15 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    refresh.bat:

    "..\node_modules\.bin\nswag" run
    
  • User Avatar
    0
    mdframe created

    I know this is me... so I apologize for the dumb questions. My Windows 10 machine was sent back for repair so I am trying to understand development on my Mac. When I run the command I get the following error while executing from the angular directory:

    $ "..\node_modules\.bin\nswag" run -bash ..\node_modules\.bin\nswag: command not found

    When I look through the directory I see that nswag is nswag.js.

    Thanks.

  • User Avatar
    0
    mdframe created

    Okay, so I changed the slashes and now I get that it is looking for Microsoft.NETCore.App version 1.1.2 was not found. Can I force this to use 2.1.2 or 2.1.5 or do I have to install the older version? I will give it a try...

  • User Avatar
    0
    aaron created
    Support Team

    Show the stack trace.

  • User Avatar
    0
    mdframe created

    `Matthews-MacBook-Pro:angular f2tek$ "./node_modules/.bin/nswag" dotnet run NSwag NPM CLI It was not possible to find any compatible framework version The specified framework 'Microsoft.NETCore.App', version '1.1.2' was not found.

    • Check application dependencies and target a framework version installed at: /usr/local/share/dotnet/
    • Installing .NET Core prerequisites might help resolve this problem: http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
    • The .NET Core framework and SDK can be installed from: https://aka.ms/dotnet-download
    • The following versions are installed: 2.1.2 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] 2.1.5 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] child_process.js:645 throw err; ^

    Error: Command failed: dotnet "/Users/f2tek/Documents/Projects/C-Sharp/angular/node_modules/nswag/bin/binaries/NetCore11/dotnet-nswag.dll" dotnet run at checkExecSyncError (child_process.js:602:13) at Object.execSync (child_process.js:642:13) at c.exec (/Users/f2tek/Documents/Projects/C-Sharp/angular/node_modules/nswag/bin/nswag.js:66:11) at ChildProcess.exithandler (child_process.js:268:7) at emitTwo (events.js:126:13) at ChildProcess.emit (events.js:214:7) at maybeClose (internal/child_process.js:915:16) at Socket.stream.socket.on (internal/child_process.js:336:11) at emitOne (events.js:116:13) at Socket.emit (events.js:211:7)`

  • User Avatar
    0
    aaron created
    Support Team

    Specify /runtime:NetCore20.

  • User Avatar
    0
    mdframe created

    Matthews-MacBook-Pro:angular f2tek$ "./node_modules/.bin/nswag" run /runtime:NetCore20 . NSwag NPM CLI NSwag command line tool for .NET Core NetCore20, toolchain v11.17.21.0 (NJsonSchema v9.10.63.0 (Newtonsoft.Json v9.0.0.0)) Visit http://NSwag.org for more information. NSwag bin directory: Users/f2tek/Documents/Projects/C-Sharp/angular/node_modules/nswag/bin/binaries/NetCore20 Current directory does not contain any .nswag files. Duration: 00:00:00.0477912 Matthews-MacBook-Pro:angular f2tek$

  • User Avatar
    0
    mdframe created

    `Matthews-MacBook-Pro:nswag f2tek$ "../node_modules/.bin/nswag" run /runtime:NetCore20 . NSwag NPM CLI NSwag command line tool for .NET Core NetCore20, toolchain v11.17.21.0 (NJsonSchema v9.10.63.0 (Newtonsoft.Json v9.0.0.0)) Visit http://NSwag.org for more information. NSwag bin directory: Users/f2tek/Documents/Projects/C-Sharp/angular/node_modules/nswag/bin/binaries/NetCore20

    Executing file '/Users/f2tek/Documents/Projects/C-Sharp/angular/nswag/service.config.nswag'... System.Net.Http.HttpRequestException: Connection refused ---> System.Net.Sockets.SocketException: Connection refused at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask1.get_Result() at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask1.get_Result() at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask1 creationTask) at System.Threading.Tasks.ValueTask1.get_Result() at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) at CallSite.Target(Closure , CallSite , Object ) at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0) at NJsonSchema.Infrastructure.DynamicApis.HttpGetAsync(String url) at NSwag.SwaggerDocument.FromUrlAsync(String url) in C:\projects\nswag\src\NSwag.Core\SwaggerDocument.cs:line 178 at NSwag.Commands.OutputCommandBase.ReadSwaggerDocumentAsync(String input) in C:\projects\nswag\src\NSwag.Commands\Commands\OutputCommandBase.cs:line 36 at NSwag.Commands.SwaggerGeneration.FromSwaggerCommand.RunAsync() in C:\projects\nswag\src\NSwag.Commands\Commands\SwaggerGeneration\FromSwaggerCommand.cs:line 62 at NSwag.Commands.SwaggerGeneration.FromSwaggerCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in C:\projects\nswag\src\NSwag.Commands\Commands\SwaggerGeneration\FromSwaggerCommand.cs:line 53 at NSwag.Commands.NSwagDocumentBase.GenerateSwaggerDocumentAsync() in C:\projects\nswag\src\NSwag.Commands\NSwagDocumentBase.cs:line 268 at NSwag.Commands.NSwagDocument.ExecuteAsync() in C:\projects\nswag\src\NSwag.Commands\NSwagDocument.cs:line 81 at NSwag.Commands.Document.ExecuteDocumentCommand.ExecuteDocumentAsync(IConsoleHost host, String filePath) in C:\projects\nswag\src\NSwag.Commands\Commands\Document\ExecuteDocumentCommand.cs:line 77 at NSwag.Commands.Document.ExecuteDocumentCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in C:\projects\nswag\src\NSwag.Commands\Commands\Document\ExecuteDocumentCommand.cs:line 43 at NConsole.CommandLineProcessor.ProcessSingleAsync(String[] args, Object input) at NConsole.CommandLineProcessor.ProcessAsync(String[] args, Object input) at NConsole.CommandLineProcessor.Process(String[] args, Object input) at NSwag.Commands.NSwagCommandProcessor.Process(String[] args) in C:\projects\nswag\src\NSwag.Commands\NSwagCommandProcessor.cs:line 54child_process.js:645 throw err; ^

    Error: Command failed: dotnet "/Users/f2tek/Documents/Projects/C-Sharp/angular/node_modules/nswag/bin/binaries/NetCore20/dotnet-nswag.dll" run /runtime:NetCore20 . at checkExecSyncError (child_process.js:602:13) at Object.execSync (child_process.js:642:13) at c.exec (/Users/f2tek/Documents/Projects/C-Sharp/angular/node_modules/nswag/bin/nswag.js:54:19) at ChildProcess.exithandler (child_process.js:268:7) at emitTwo (events.js:126:13) at ChildProcess.emit (events.js:214:7) at maybeClose (internal/child_process.js:915:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5) Matthews-MacBook-Pro:nswag f2tek$ `

    I do have the host application running and swagger is active in the browser.

  • User Avatar
    0
    aaron created
    Support Team

    Check the url in angular/nswag/service.config.nswag.

  • User Avatar
    0
    mdframe created

    Found the issue, although swagger is on localhost:22742 the port for the .nswag file should be set to 5000 as http://localhost:5000/swagger/v1/swagger.json. Once I updated the file it seems to have created the proxy correctly.

    npm start results in a new error which I am investigating now.

    `Matthews-MacBook-Pro:angular f2tek$ npm start

    [email protected] start /Users/f2tek/Documents/Projects/C-Sharp/angular ng serve --host 0.0.0.0 --port 4200

    ** Angular Live Development Server is listening on 0.0.0.0:4200, open your browser on http://localhost:4200/ **

    Date: 2018-10-20T17:32:48.576Z Hash: 3fb89ae7e4a813fec58c Time: 12588ms chunk {main} main.js, main.js.map (main) 1.95 kB [initial] [rendered] chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 693 bytes [initial] [rendered] chunk {runtime} runtime.js, runtime.js.map (runtime) 5.22 kB [entry] [rendered] chunk {scripts} scripts.js, scripts.js.map (scripts) 1.51 MB [rendered] chunk {styles} styles.js, styles.js.map (styles) 2.1 MB [initial] [rendered] chunk {vendor} vendor.js, vendor.js.map (vendor) 325 kB [initial] [rendered]

    ERROR in error TS1149: File name '/Users/f2tek/Documents/Projects/C-Sharp/angular/src/shared/helpers/XMLHttpRequestHelper.ts' differs from already included file name '/Users/f2tek/Documents/Projects/C-Sharp/angular/src/shared/helpers/XmlHttpRequestHelper.ts' only in casing.

    ℹ 「wdm」: Failed to compile.

    `

    Thanks for all your help! I would not have figured any of this out without you.

    MAtt

  • User Avatar
    0
    aaron created
    Support Team

    Rename XMLHttpRequestHelper.ts to XmlHttpRequestHelper.ts.

  • User Avatar
    0
    mdframe created

    I renamed the file to match the case and all errors are gone however the login page never appears, just the processing icon. I am investigating the situation.

  • User Avatar
    0
    aaron created
    Support Team

    Check the browser console.

  • User Avatar
    0
    mdframe created

    Thanks a bunch, I got everything on the same port and it works like a champ! I know a lot more about the application now because of this challenge.

  • User Avatar
    0
    aaron created
    Support Team

    That's great :)