question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The library 'libhostpolicy.dylib' required to execute the application.

See original GitHub issue

Hello,

When I installed https://www.npmjs.com/package/nswag, I receive this weird “The library ‘libhostpolicy.dylib’ required to execute the application was not found in ___”

NSwag NPM CLI
A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/Users/xxx/.nvm/versions/node/v8.1.2/lib/node_modules/nswag/bin/binaries/netcoreapp1.1/'.
child_process.js:631
    throw err;
    ^

Error: Command failed: dotnet "/Users/xxx/.nvm/versions/node/v8.1.2/lib/node_modules/nswag/bin/binaries/netcoreapp1.1/dotnet-nswag.dll" help --core 1.1
    at checkExecSyncError (child_process.js:588:13)
    at Object.execSync (child_process.js:628:13)
    at Object.<anonymous> (/Users/xxx/.nvm/versions/node/v8.1.2/lib/node_modules/nswag/bin/nswag.js:37:11)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:158:16)

I’ve tried a few things.

  1. Tried looking for the dynamic library online. Apparently a lot of people seem to have this issue with @dotnet/cli, A quick search in the issues seem that a lot of MacOS folks have similar issues. However I could not isolate the issue.
  2. Install different versions of the dotnet core.
  3. Trying to build the NSwag with build/*.bat but did not compile successfully.

Help would be greatly appreciated!

Dotnet info:

.NET Command Line Tools (2.1.0-preview1-006703)

Product Information:
 Version:            2.1.0-preview1-006703
 Commit SHA-1 hash:  512b568e33

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.1.0-preview1-006703/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0-preview3-25502-01
  Build    : bd3f818bad84f1296b4ee53f72ab8837b3caac98

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
rado0x54commented, Jul 19, 2017

Hey I just encountered the same problem with the current npm package under Mac OS. Adding a <OutputType>Exe</OutputType> to the main PropertyGroup of NSwag.ConsoleCore/NSwag.ConsoleCore.csproj and rebuilding under Windows fixes the issue. It produces a valid NPM binary configuration by adding a dotnet-nswag.runtimeconfig.json to the publish directory. With that file present, the execution works fine.

mriedels-mbp15:netcoreapp1.1 mriedel$ dotnet dotnet-nswag.dll 
NSwag command line tool for .NET Core, toolchain v11.3.3.0 (NJsonSchema v9.4.2.0) (x64)
Visit http://NSwag.org for more information.
NSwag bin directory: Users/mriedel/Projects/Xavo/Devel-Eval/JSON-Schema/code/NJsonSchemaDemo/node_modules/nswag/NSwag.Npm/bin/binaries/netcoreapp1.1
Execute the 'help' command to show a list of all the available commands.
Commands: 
  help
  types2swagger
  webapi2swagger
  new
  run
  jsonschema2csclient
  jsonschema2tsclient
  swagger2csclient
  swagger2cscontroller
  swagger2tsclient
  version
Command: 

@RSuter A new release would be appreciated. 😃

2reactions
RicoSutercommented, Jul 19, 2017

Please test with NPM package v11.3.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

A fatal error was encountered. The library 'libhostpolicy.so ...
The library 'libhostpolicy.dylib' required to execute the application was not found in '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0 ...
Read more >
Libhostpolicy.dylib missing - Meadow Development
The library 'libhostpolicy.dylib' required to execute the application was not found in '/Users/tpitman/Projects/Meadow/HelloWorld/HelloWorld/bin ...
Read more >
Question about Dotnet for MacOS : r/learnprogramming
The library 'libhostpolicy.dylib' required to execute the application was not found in '/Users/aleksosaurus/Desktop/files/a lot of ...
Read more >
Experienced an issue running .net 5 project on new m1
An error occurred while loading required library libhostpolicy.dylib from [/usr/local/share/dotnet/shared/Microsoft.NETCore.App/5.0.6].
Read more >
A fatal error was encountered. The library 'libhostpolicy.so' ...
The library 'libhostpolicy.so' required to execute the application was not found in '/var/nop420/'. Failed to run as a self-contained app. If this should...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found