danielmiessler / fabric

fabric is an open-source framework for augmenting humans using AI. It provides a modular framework for solving specific problems using a crowdsourced set of AI prompts that can be used anywhere.

Home Page:https://danielmiessler.com/p/fabric-origin-story

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: (Windows 10) Running `fabric --gui` results in an error

Gerkinfeltser opened this issue · comments

What happened?

Thanks again so much for the interesting project!
I'm getting a FileNotFoundError when I attempt to run fabric --gui

PS C:\Users\xxx\> fabric --gui
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\xxx\.local\bin\fabric.exe\__main__.py", line 7, in <module>
  File "C:\Users\xxx\AppData\Local\pipx\pipx\venvs\fabric\Lib\site-packages\installer\client\cli\fabric.py", line 100, in main
    run_electron_app()
  File "C:\Users\xxx\AppData\Local\pipx\pipx\venvs\fabric\Lib\site-packages\installer\client\cli\utils.py", line 774, in run_electron_app
    subprocess.run(['npm', '--version'], check=True,
  File "C:\ProgramData\anaconda3\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\ProgramData\anaconda3\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified

Furthermore,

  • both Node & npm are installed (as well as electron) & the commands are in my user's path.
  • Running the fabric --gui command gives me the same error when in the fabric venv or not.
  • I'm running fabric on Windows 10.

Thanks again!

Version check

  • Yes I was.

Relevant log output

No response

Relevant screenshots (optional)

No response

Try again I think we fixed some WSL stuff recently.

Hmmm, still no luck. Just updated but the error persists.

Hello again, I was able to get the --gui working after some trial and error. My solution isn’t the best as it requires adding a hard coded path to npm but for my current purposes this is an acceptable trade off. Both node & npm were installed prior & npm's location added to my system path but fabric still seemed to be having issues finding them. Not exactly sure of the reason for my troubles but I assume it’s connected to multiple venvs, conda, etc. but I haven’t looked too deeply into it. I'm just relieved its working.

Anyway, here’s what got the gui running for me on windows 10:

  1. In the C:\Users\XXX\AppData\Local\pipx\pipx\venvs\fabric\Lib\site-packages\installer\client\cli\utils.py file’s run_electron_app method (last one in the file) I added npm_path = r'C:/Program Files/nodejs/npm.cmd' (replace the path with the correct one for your setup of course).
    Example:
...
def run_electron_app():
    
    npm_path = r'C:/Program Files/nodejs/npm.cmd'
...
  1. In the same method, replace instances of ’npm’ (with quotes) with the newly added npm_path variable (without quotes). In the current version, there were 3 instances that needed to be changed.

Hopefully no one else runs into this issue but for the benefit of those who do (& to a future me that needs to remember how I get this working) I’ll leave this here!

Thanks again for the project!