Running libraries with Haxelib leads to `Module not found`, printing out a path containing ^'s

48 Views Asked by At

Calling haxelib run <LIBRARY> <ARGS> leads to Uncaught exception - load.c(181) : Module not found : ^C:\HaxeToolkit\haxe\lib\<LIBRARY>/<VERSION_NUM>/run.n^ with carets (^) present in the path.

Haxe 64-bit 4.3.2, Haxelib 4.1.0.

I'm running Windows 10 with latest updates. This issue is present on both PowerShell and CMD shells, also tested with Microsoft Terminal and Wezterm.

Haxelib is the package manager for the Haxe programming language. I need to run some library commands, but whenever I attempt to do so it fails with the same issue. Here is an example with the formatter library:

PS C:\Users\<USER>> haxelib run formatter
Uncaught exception - load.c(181) : Module not found : ^C:\HaxeToolkit\haxe\lib\formatter/1^,15^,0/run.n^

This holds true for other libraries (like lime) as well. It always fail, printing out what seems to be a corrupted path to the run.n-script of the library. The path always contains carats (^) before and after the string and before the commas (,). Looking up the exception online shows the paths without the carats.

I've attempted the following, but to no avail:

  • Reinstall Haxe.
  • Downgrade Haxe to an earlier version (4.2.0) that I knew to work before.
  • Install Haxe 32-bit instead.
  • Setup Haxelib in a separate folder.
  • Setup Haxelib on a separate disk.

I have no idea why this is occurring, it used to work before without any issue. It might be related to this issue I'm having as well: (PowerShell does not recognize Visual Studio Code commands) as both issues happen to occur recently, although the other one does work in CMD while this issue fails on both PS and CMD.

EDIT

I also attempted to run the command with powershell -NoProfile, but same error.

Output of %SystemRoot%\System32\where.exe haxelib:

>%SystemRoot%\System32\where.exe haxelib
C:\HaxeToolkit\haxe\haxelib.exe

Curiously, this only worked in CMD and not in the PowerShell shell where the following occurred:

PS > %SystemRoot%\System32\where.exe haxelib
%SystemRoot%\System32\where.exe : The module '%SystemRoot%' could not be loaded. For more information, run
'Import-Module %SystemRoot%'.
At line:1 char:1
+ %SystemRoot%\System32\where.exe haxelib
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (%SystemRoot%\System32\where.exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CouldNotAutoLoadModule

AutoRun:

> %SystemRoot%\System32\reg.exe QUERY "HKCU\Software\Microsoft\Command Processor" /v AutoRun


ERROR: The system was unable to find the specified registry key or value.

User enviroment:

>%SystemRoot%\System32\reg.exe QUERY HKCU\Environment

HKEY_CURRENT_USER\Environment
    ChocolateyLastPathUpdate    REG_SZ    133172327060346480
    CLion    REG_SZ    C:\Program Files\JetBrains\CLion 2022.3.2\bin;
    HOME    REG_SZ    C:\Users\<USER>
    OneDrive    REG_EXPAND_SZ    E:\OneDrive
    OneDriveConsumer    REG_EXPAND_SZ    E:\OneDrive
    Path    REG_EXPAND_SZ    C:\Program Files\Microsoft\jdk-11.0.12.7-hotspot\bin;C:\Program Files\Eclipse Adoptium\jdk-11.0.13.8-hotspot\bin;C:\Program Files\Eclipse Adoptium\jdk-8.0.312.7-hotspot\bin;C:\Program Files\Eclipse Adoptium\jre-8.0.312.7-hotspot\bin;C:\Program Files\Eclipse Adoptium\jre-11.0.13.8-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\HaxeToolkit\haxe;C:\HaxeToolkit\neko;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\WezTerm;%HAXEPATH%;%NEKO_INSTPATH%;C:\Users\<USER>\AppData\Local\Programs\Microsoft VS Code\bin;%USERPROFILE%\.dotnet\tools
    TEMP    REG_EXPAND_SZ    %USERPROFILE%\AppData\Local\Temp
    TMP    REG_EXPAND_SZ    %USERPROFILE%\AppData\Local\Temp

System enviroment:

>%SystemRoot%\System32\reg.exe QUERY "HKLM\System\CurrentControlSet\Control\Session Manager\Environment"

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment
    ChocolateyInstall    REG_SZ    C:\ProgramData\chocolatey
    ComSpec    REG_EXPAND_SZ    %SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe
    DriverData    REG_SZ    C:\Windows\System32\Drivers\DriverData
    JAVA_HOME    REG_SZ    C:\Program Files\Eclipse Adoptium\jdk-8.0.312.7-hotspot\
    NUMBER_OF_PROCESSORS    REG_SZ    8
    OS    REG_SZ    Windows_NT
    Path    REG_EXPAND_SZ    C:\Program Files\Microsoft\jdk-11.0.12.7-hotspot\bin;C:\Program Files\Eclipse Adoptium\jdk-11.0.13.8-hotspot\bin;C:\Program Files\Eclipse Adoptium\jdk-8.0.312.7-hotspot\bin;C:\Program Files\Eclipse Adoptium\jre-8.0.312.7-hotspot\bin;C:\Program Files\Eclipse Adoptium\jre-11.0.13.8-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\HaxeToolkit\haxe;C:\HaxeToolkit\neko;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\WezTerm;%HAXEPATH%;%NEKO_INSTPATH%
    PATHEXT    REG_SZ    .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    PROCESSOR_ARCHITECTURE    REG_SZ    AMD64
    PROCESSOR_IDENTIFIER    REG_SZ    Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
    PROCESSOR_LEVEL    REG_SZ    6
    PROCESSOR_REVISION    REG_SZ    3a09
    PSModulePath    REG_EXPAND_SZ    %ProgramFiles%\WindowsPowerShell\Modules;%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules
    TEMP    REG_EXPAND_SZ    %SystemRoot%\TEMP
    TMP    REG_EXPAND_SZ    %SystemRoot%\TEMP
    USERNAME    REG_SZ    SYSTEM
    VBOX_MSI_INSTALL_PATH    REG_SZ    C:\Program Files\Oracle\VirtualBox\
    windir    REG_EXPAND_SZ    %SystemRoot%
    HAXEPATH    REG_SZ    C:\HaxeToolkit\haxe
    NEKO_INSTPATH    REG_SZ    C:\HaxeToolkit\neko
0

There are 0 best solutions below