JavaScriptEngineSwitcher: [OSX] ChakraCore DLL not found

I’m having an issue where the ChakraCore DLL is not found, even if the JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64 package is installed.

This is using dotnet core 1.1 with Visual Studio for Mac, same results with the dotnet cli tools.

Some minimal code to get the exception:

using JavaScriptEngineSwitcher.Core;
using JavaScriptEngineSwitcher.ChakraCore;

namespace MyNamespace
{
    public class Program
    {
        public static void Main(string[] args)
        {            
            IJsEngine engine = new ChakraCoreJsEngine();
            engine.CollectGarbage();
        }
    }
}

The full exception is:

Unhandled Exception: JavaScriptEngineSwitcher.Core.JsEngineLoadException: During loading of ChakraCoreJsEngine error has occurred.	
See more details:

Unable to load DLL 'ChakraCore': The specified module could not be found.
 (Exception from HRESULT: 0x8007007E) ---> System.DllNotFoundException: Unable to load DLL 'ChakraCore': The specified module could not be found.
 (Exception from HRESULT: 0x8007007E)
   at JavaScriptEngineSwitcher.ChakraCore.JsRt.NativeMethods.JsCreateRuntime(JsRuntimeAttributes attributes, JsThreadServiceCallback threadService, JsRuntime& runtime)
   at JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngine.<>c__DisplayClass18_0.<.ctor>b__0()
   --- End of inner exception stack trace ---
   at JavaScriptEngineSwitcher.ChakraCore.ScriptDispatcher.InnnerInvoke(Func`1 del)
   at PunchOutWebFrontend.Program.Main(String[] args) in /Users/steego/Dropbox/Work/DotNet/PunchOut/PunchOut.App.Web/Program.cs:line 17

The csproj file:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
    <PackageReference Include="React.Core" Version="3.0.1" />
    <PackageReference Include="React.AspNet" Version="3.0.1" />
    <PackageReference Include="JavaScriptEngineSwitcher.Core" Version="2.4.0" />
    <PackageReference Include="JavaScriptEngineSwitcher.Msie" Version="2.4.0" />
    <PackageReference Include="JavaScriptEngineSwitcher.ChakraCore" Version="2.4.1" />
    <PackageReference Include="JavaScriptEngineSwitcher.Jint" Version="2.4.0" />
    <PackageReference Include="JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64" Version="2.4.1" />
    <PackageReference Include="JavaScriptEngineSwitcher.Extensions.MsDependencyInjection" Version="2.4.0" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="wwwroot\images\" />
    <Folder Include="wwwroot\js\" />
    <Folder Include="wwwroot\css\" />
  </ItemGroup>
</Project>

I’m running the project on OSX Sierra 10.12.4:

Darwin MacBook-Pro.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar  3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64

The library is installed in:

~/.nuget/packages/javascriptengineswitcher.chakracore.native.osx-x64/2.4.1/runtimes/osx-x64/native/libChakraCore.dylib

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

Do you know if there is a way to see the filename it is trying to locate, and the search paths?

Unfortunately, I don’t know. I recommend before launching the website from the command line, execute the following commands:

export DYLD_PRINT_LIBRARIES=1
export ASPNETCORE_ENVIRONMENT=Development

Maybe it needs to be re-built for sierra?

I have no such possibility, but you can do it yourself. In the official building instructions there is not enough information yet, so use my instructions:

Install dependencies:

xcode-select --install
brew install cmake icu4c

To build the ChakraCore you must first clone the ChakraCore repository:

mkdir Github && cd Github
git clone https://github.com/Microsoft/ChakraCore.git
cd ChakraCore
git checkout v1.4.3

Run the build script:

./build.sh --icu=/usr/local/opt/icu4c/include -j=2

After the build is complete, copy libChakraCore.dylib file from ~/Github/ChakraCore/BuildLinux/Release directory to ~/.nuget/packages/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/2.4.1/runtimes/osx-x64/native directory.