Skip to content

Cannot find fnm installed npm and npx #683

Open
@SuibianP

Description

@SuibianP

Operating System

Windows 11 (24H2 26100.2314)

Expected Behavior

fnm installed node should function without problem.

Also, e should check for the existence of its prerequisites and fail straight away otherwise.

Actual Behavior

e cannot find npm and npx from fnm.

> fnm env --use-on-cd --shell power-shell | Out-String | Invoke-Expression
> fnm use 20
Using Node v20.17.0
> e help init
Checking for build-tools updates
'npm' is not recognized as an internal or external command,
operable program or batch file.
'npx' is not recognized as an internal or external command,
operable program or batch file.
Running "git pull origin main --rebase --autostash" in C:\Users\jialunhu.intern\.electron_build_tools
From https://github.com/electron/build-tools
 * branch            main       -> FETCH_HEAD
build-tools is up-to-date
<omitted for brevity>
> e init --bootstrap testing
Applying: fix: rename sqlite win32 exports to avoid conflicts with Node.js
Hook 'python3 src/electron/script/apply_all_patches.py src/electron/patches/config.json' took 127.26 secs
subprocess2(143) __init__:python3 src/electron/script/patches-mtime-cache.py apply --cache-file src/electron/patches/mtime-cache.json;  cwd=C:\Users\jialunhu.intern\electron\electron
________ running 'python3 src/electron/script/patches-mtime-cache.py apply --cache-file src/electron/patches/mtime-cache.json' in 'C:\Users\jialunhu.intern\electron\electron'
subprocess2(143) __init__:python3 -c import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["python3", "script/lib/npx.py", "[email protected]", "install", "--frozen-lockfile"]);;  cwd=C:\Users\jialunhu.intern\electron\electron
________ running 'python3 -c import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["python3", "script/lib/npx.py", "[email protected]", "install", "--frozen-lockfile"]);' in 'C:\Users\jialunhu.intern\electron\electron'
Traceback (most recent call last):
  File "C:\Users\jialunhu.intern\electron\electron\src\electron\script\lib\npx.py", line 21, in <module>
    npx(*sys.argv[1:])
  File "C:\Users\jialunhu.intern\electron\electron\src\electron\script\lib\npx.py", line 10, in npx
    subprocess.check_call(call_args, env=npx_env)
  File "C:\Users\jialunhu.intern\.electron_build_tools\third_party\depot_tools\bootstrap-2@3_11_8_chromium_35_bin\python3\bin\Lib\subprocess.py", line 408, in check_call
    retcode = call(*popenargs, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jialunhu.intern\.electron_build_tools\third_party\depot_tools\bootstrap-2@3_11_8_chromium_35_bin\python3\bin\Lib\subprocess.py", line 389, in call
    with Popen(*popenargs, **kwargs) as p:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jialunhu.intern\.electron_build_tools\third_party\depot_tools\bootstrap-2@3_11_8_chromium_35_bin\python3\bin\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\jialunhu.intern\.electron_build_tools\third_party\depot_tools\bootstrap-2@3_11_8_chromium_35_bin\python3\bin\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
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\jialunhu.intern\.electron_build_tools\third_party\depot_tools\bootstrap-2@3_11_8_chromium_35_bin\python3\bin\Lib\subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['python3', 'script/lib/npx.py', '[email protected]', 'install', '--frozen-lockfile']' returned non-zero exit status 1.
Error: Command 'python3 -c import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["python3", "script/lib/npx.py", "[email protected]", "install", "--frozen-lockfile"]);' returned non-zero exit status 1 in C:\Users\jialunhu.intern\electron\electron
Traceback (most recent call last):
  File "C:\Users\jialunhu.intern\electron\electron\src\electron\script\lib\npx.py", line 21, in <module>
    npx(*sys.argv[1:])
  File "C:\Users\jialunhu.intern\electron\electron\src\electron\script\lib\npx.py", line 10, in npx
    subprocess.check_call(call_args, env=npx_env)
  File "C:\Users\jialunhu.intern\.electron_build_tools\third_party\depot_tools\bootstrap-2@3_11_8_chromium_35_bin\python3\bin\Lib\subprocess.py", line 408, in check_call
    retcode = call(*popenargs, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jialunhu.intern\.electron_build_tools\third_party\depot_tools\bootstrap-2@3_11_8_chromium_35_bin\python3\bin\Lib\subprocess.py", line 389, in call
    with Popen(*popenargs, **kwargs) as p:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jialunhu.intern\.electron_build_tools\third_party\depot_tools\bootstrap-2@3_11_8_chromium_35_bin\python3\bin\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\jialunhu.intern\.electron_build_tools\third_party\depot_tools\bootstrap-2@3_11_8_chromium_35_bin\python3\bin\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
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\jialunhu.intern\.electron_build_tools\third_party\depot_tools\bootstrap-2@3_11_8_chromium_35_bin\python3\bin\Lib\subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['python3', 'script/lib/npx.py', '[email protected]', 'install', '--frozen-lockfile']' returned non-zero exit status 1.

ERROR gclient sync failed
ERROR Error: Command failed: C:\Users\jialunhu.intern\AppData\Local\fnm_multishells\12788_1732435168359\node.exe C:\Users\jialunhu.intern\.electron_build_tools\src\e sync -v
    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at checkExecSyncError (node:child_process:891:11)
    at Object.execFileSync (node:child_process:927:15)
    at Command.<anonymous> (C:\Users\jialunhu.intern\.electron_build_tools\src\e-init.js:204:22)
    at Command.listener [as _actionHandler] (C:\Users\jialunhu.intern\.electron_build_tools\node_modules\commander\lib\command.js:480:17)
    at C:\Users\jialunhu.intern\.electron_build_tools\node_modules\commander\lib\command.js:1234:65
    at Command._chainOrCall (C:\Users\jialunhu.intern\.electron_build_tools\node_modules\commander\lib\command.js:1151:12)
    at Command._parseCommand (C:\Users\jialunhu.intern\.electron_build_tools\node_modules\commander\lib\command.js:1234:27)
    at Command.parse (C:\Users\jialunhu.intern\.electron_build_tools\node_modules\commander\lib\command.js:889:10)

To Reproduce

  • Install and activate fnm, fnm use 20
  • npm i -g @electron/build-tools
  • e init --bootstrap testing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions