Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: slither fails to run "FileNotFoundError: [WinError 2] The system cannot find the file specified" #1103

Closed
Ellahinator opened this issue Mar 11, 2022 · 25 comments
Labels
bug Something isn't working

Comments

@Ellahinator
Copy link

Ellahinator commented Mar 11, 2022

What happened?

I tried running
slither .
slither --solc-remaps @openzeppelin/=$(pwd)/node_modules/@openzeppelin/ .
Also tried uninstalling and reinstalling solc via npm.

Version

0.8.2

Relevant log output

slither .
'npx hardhat compile --force' running
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 73, in process_all
    compilations = compile_all(target, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
    self._compile(**kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
    self._platform.compile(self, **kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\hardhat.py", line 72, in compile
    with subprocess.Popen(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
None
Error in .
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 73, in process_all
    compilations = compile_all(target, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
    self._compile(**kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
    self._platform.compile(self, **kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\hardhat.py", line 72, in compile
    with subprocess.Popen(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
@Ellahinator Ellahinator added the bug Something isn't working label Mar 11, 2022
@elopez
Copy link
Member

elopez commented Mar 11, 2022

Hi @Ellahinator, thanks for your report. Can you confirm if you have a working node & hardhat setup?

In particular, Slither expects the following command to work and build your project: npx hardhat compile --force but from the error message, it looks like it is not working.

If npx is the problem, you can try disabling it with slither --npx-disable . and see if that helps.

@Ellahinator
Copy link
Author

hmmm hardhat seems to be working fine when I do npx hardhat compile --force,
and I get the same exact error when running slither --npx-disable .

slither --npx-disable .
'hardhat compile --force' running
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 73, in process_all
    compilations = compile_all(target, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
    self._compile(**kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
    self._platform.compile(self, **kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\hardhat.py", line 72, in compile
    with subprocess.Popen(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
None
Error in .
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 73, in process_all
    compilations = compile_all(target, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
    self._compile(**kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
    self._platform.compile(self, **kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\hardhat.py", line 72, in compile
    with subprocess.Popen(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

@elopez
Copy link
Member

elopez commented Mar 11, 2022

If hardhat works fine, you can compile manually with the command from above and then invoke slither with slither --hardhat-ignore-compile . which should skip the compilation step.

If that works, can you please fill an issue on crytic-compile so we can track why executing hardhat fails on Windows? Slither uses crytic-compile under the hood for the project compilation.

@Ellahinator
Copy link
Author

error when running slither --hardhat-ignore-compile . :(

PS C:\Users\Danny\nnppmm> npx hardhat compile --force       
Compiled 2 Solidity files successfully
PS C:\Users\Danny\nnppmm> slither --hardhat-ignore-compile .
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 84, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 67, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\slither.py", line 97, in __init__
    parser.parse_top_level_from_loaded_json(ast, path)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224, in parse_top_level_from_loaded_json      
    get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
    filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup
    raise ValueError(
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol']
None
Error in .
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 84, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 67, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\slither.py", line 97, in __init__
    parser.parse_top_level_from_loaded_json(ast, path)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224, in parse_top_level_from_loaded_jsoned_json
    get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
    filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup
    raise ValueError(                                                                                                                                                         nnppmm\\contracts\\Greeter.sol
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\rdhat\\console.sol']nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol']

@elopez
Copy link
Member

elopez commented Mar 11, 2022

That might be related to #1065, if you are comfortable with it could you try installing that modified branch (pip3 install -U https://github.com/elopez/slither/archive/refs/heads/fix-windows-paths.zip) and report back if it helped?

@Ellahinator
Copy link
Author

same issue

PS C:\Users\Danny\nnppmm> slither --hardhat-ignore-compile .
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 84, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 67, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\slither.py", line 97, in __init__
    parser.parse_top_level_from_loaded_json(ast, path)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224, in parse_top_level_from_loaded_json
    get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
    filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup
    raise ValueError(
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol']
None
Error in .
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 84, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 67, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\slither.py", line 97, in __init__
    parser.parse_top_level_from_loaded_json(ast, path)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224, in parse_top_level_from_loaded_json
    get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
    filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup
    raise ValueError(
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol']

@Ellahinator
Copy link
Author

I also tried downgrading the solidity extension but that didnt do anything.

@Ellahinator
Copy link
Author

error when trying to run specific file

PS C:\Users\Danny\nnppmm> slither contracts/Greeter.sol
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 369, in get_version 
    with subprocess.Popen(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 73, in process_all
    compilations = compile_all(target, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__   
    self._compile(**kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
    self._platform.compile(self, **kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 153, in compile
    targets_json = _get_targets_json(compilation_unit, self._target, **kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 275, in _get_targets_json
    return _run_solc(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 471, in _run_solc
    compiler="solc", version=get_version(solc, env), optimized=is_optimized(solc_arguments)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 380, in get_version
    raise InvalidCompilation(error)
crytic_compile.platform.exceptions.InvalidCompilation: [WinError 2] The system cannot find the file specified
None
Error in contracts/Greeter.sol
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 369, in get_version
    with subprocess.Popen(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 73, in process_all
    compilations = compile_all(target, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
    self._compile(**kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
    self._platform.compile(self, **kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 153, in compile
    targets_json = _get_targets_json(compilation_unit, self._target, **kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 275, in _get_targets_json
    return _run_solc(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 471, in _run_solc
    compiler="solc", version=get_version(solc, env), optimized=is_optimized(solc_arguments)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 380, in get_version
    raise InvalidCompilation(error)
crytic_compile.platform.exceptions.InvalidCompilation: [WinError 2] The system cannot find the file specified

@Ellahinator
Copy link
Author

uninstalled and reinstalled crytic-compile
error when running crytic-compile .

PS C:\Users\Danny\nnppmm> crytic-compile .
INFO:CryticCompile:'npx hardhat compile --force' running
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\Scripts\crytic-compile.exe\__main__.py", line 7, in <module>
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\__main__.py", line 192, in main
    compilations = compile_all(**vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
    self._compile(**kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
    self._platform.compile(self, **kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\hardhat.py", line 72, in compile
    with subprocess.Popen(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1435, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

@staa99
Copy link

staa99 commented Mar 21, 2022

I have a similar problem. In my own case, the build-info is in a different location (team conventions). Is there a way to configure slither to locate it?

@elopez
Copy link
Member

elopez commented Mar 21, 2022

@Ellahinator I have been working on some more Windows fixes that might help you with your problem, would you mind testing the following crytic-compile branch?

https://github.com/crytic/crytic-compile/tree/dev-windows-long-paths

You can install it by running pip3 install -U https://github.com/crytic/crytic-compile/archive/refs/heads/dev-windows-long-paths.zip

@elopez
Copy link
Member

elopez commented Mar 21, 2022

I have a similar problem. In my own case, the build-info is in a different location (team conventions). Is there a way to configure slither to locate it?

Hi @staa99, are you looking for something like --truffle-build-directory, --hardhat-artifacts-directory or --hardhat-cache-directory? If that's not it, can you create a new issue with your feature request so we can track it independently of this bug? Thanks!

@staa99
Copy link

staa99 commented Mar 21, 2022

Thanks @elopez. This works for me

@Ellahinator
Copy link
Author

@Ellahinator I have been working on some more Windows fixes that might help you with your problem, would you mind testing the following crytic-compile branch?

https://github.com/crytic/crytic-compile/tree/dev-windows-long-paths

You can install it by running pip3 install -U https://github.com/crytic/crytic-compile/archive/refs/heads/dev-windows-long-paths.zip

Successfully installed that branch. Unfortunately running into the same errors.
Tried with new terminal tab and after PC restart.

slither . Error:

PS C:\Users\Danny\nnppmm> npx hardhat compile --force
Compiled 2 Solidity files successfully
PS C:\Users\Danny\nnppmm> slither .
'npx hardhat compile --force' running
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 73, in process_all
    compilations = compile_all(target, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
    self._compile(**kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
    self._platform.compile(self, **kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\hardhat.py", line 72, in compile
    with subprocess.Popen(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
None
Error in .
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 73, in process_all
    compilations = compile_all(target, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all       
    compilations.append(CryticCompile(target, **kwargs))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
    self._compile(**kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
    self._platform.compile(self, **kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\hardhat.py", line 72, in compile
    with subprocess.Popen(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

slither --hardhat-ignore-compile . Error:

Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 84, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 67, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\slither.py", line 97, in __init__
    parser.parse_top_level_from_loaded_json(ast, path)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224, 
in parse_top_level_from_loaded_json
    get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
    filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup   
    raise ValueError(
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol']
None
Error in .
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 84, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 67, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\slither.py", line 97, in __init__
    parser.parse_top_level_from_loaded_json(ast, path)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224, 
in parse_top_level_from_loaded_json
    get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
    filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup   
    raise ValueError(
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol']

crytice-compile . Error:

PS C:\Users\Danny\nnppmm> crytic-compile .
INFO:CryticCompile:'npx hardhat compile --force' running
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\Scripts\crytic-compile.exe\__main__.py", line 7, in <module>
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\__main__.py", line 192, in main
    compilations = compile_all(**vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all      
    compilations.append(CryticCompile(target, **kwargs))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
    self._compile(**kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
    self._platform.compile(self, **kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\hardhat.py", line 72, in compile
    with subprocess.Popen(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1435, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

@elopez
Copy link
Member

elopez commented Mar 22, 2022

Checking the line numbers in the error, they don't seem to match with the new branch 🤔 Can you please double check if the new crytic-compile is getting installed successfully? You may need to remove the version you have now (pip3 uninstall crytic-compile) and then install it from the branch.

@elopez
Copy link
Member

elopez commented Mar 22, 2022

Also, you seem to have two python versions installed (3.9 and 3.10) and from the errors you posted, some tools use one, other tools use the other. Maybe that is causing confusion as well.

@Ellahinator
Copy link
Author

Only have one python installed now. The correct crytic-compile branch should be installed as well.
crytic-compile . now works.

crytic-compile .
INFO:CryticCompile:'npx hardhat compile --force' running
INFO:CryticCompile:Compiled 2 Solidity files successfully

slither . throws a new error! :D

slither .
'npx hardhat compile --force' running
Compiled 2 Solidity files successfully

Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 84, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 67, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\slither.py", line 97, in __init__
    parser.parse_top_level_from_loaded_json(ast, path)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224, in parse_top_level_from_loaded_json
    get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
    filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup
    raise ValueError(
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nppm\\contracts\\Greeter.sol']None
Error in .
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 84, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 67, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\slither.py", line 97, in __init__
    parser.parse_top_level_from_loaded_json(ast, path)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224, in parse_top_level_from_loaded_json
    get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
    filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup
    raise ValueError(
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nppm\\contracts\\Greeter.sol']
slither --hardhat-ignore-compile .
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 84, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 67, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\slither.py", line 97, in __init__
    parser.parse_top_level_from_loaded_json(ast, path)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224, in parse_top_level_from_loaded_json
    get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
    filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup
    raise ValueError(
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nppm\\contracts\\Greeter.sol']
None
Error in .
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 84, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 67, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\slither.py", line 97, in __init__
    parser.parse_top_level_from_loaded_json(ast, path)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224, in parse_top_level_from_loaded_json
    get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
    filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup
    raise ValueError(
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nppm\\contracts\\Greeter.sol']

@elopez
Copy link
Member

elopez commented Mar 22, 2022

Nice to see progress! 👍

Would you mind testing with the slither windows-ci branch as well? (pip3 uninstall slither-analyzer, pip3 install -U https://github.com/elopez/slither/archive/refs/heads/windows-ci.zip)

I tried locally on Windows with a hardhat sample project and it appeared to work fine now, when combined with the fixed crytic-compile.

If that doesn't work, is there a chance you could share your hardhat project to debug further?

@Ellahinator
Copy link
Author

Ellahinator commented Mar 22, 2022

slither . runs successfully! 🥳
However, when trying to run slither in a folder with just a .sol file, I get a similar error I was initially getting. Seems to only be working in a hardhat project folder, which I am okay with.

Here are the errors for a folder with only .sol files.

slither .
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 370, in get_version
    with subprocess.Popen(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1435, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 744, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 76, in process_all
    compilations = compile_all(target, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 658, in compile_all      
    compilations.append(CryticCompile(filename, **kwargs))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
    self._compile(**kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
    self._platform.compile(self, **kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 154, in compile
    targets_json = _get_targets_json(compilation_unit, self._target, **kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 276, in _get_targets_json 
    return _run_solc(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 474, in _run_solc
    compiler="solc", version=get_version(solc, env), optimized=is_optimized(solc_arguments)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 385, in get_version       
    raise InvalidCompilation(error)
crytic_compile.platform.exceptions.InvalidCompilation: [WinError 2] The system cannot find the file specified
None
Error in .
Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 370, in get_version       
    with subprocess.Popen(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1435, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 744, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
    compilations = compile_all(target, **vars(args))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 658, in compile_all      
    compilations.append(CryticCompile(filename, **kwargs))
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
    self._compile(**kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
    self._platform.compile(self, **kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 154, in compile
    targets_json = _get_targets_json(compilation_unit, self._target, **kwargs)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 276, in _get_targets_json 
    return _run_solc(
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 474, in _run_solc
    compiler="solc", version=get_version(solc, env), optimized=is_optimized(solc_arguments)
  File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 385, in get_version       
    raise InvalidCompilation(error)
crytic_compile.platform.exceptions.InvalidCompilation: [WinError 2] The system cannot find the file specified
crytic-compile .
ERROR:CryticCompile:[WinError 2] The system cannot find the file specified

@elopez
Copy link
Member

elopez commented Mar 22, 2022

Awesome! that other error you are getting appears to be when launching solc. Do you have solc available in path or solc-select installed? Does solc --version work on a shell?

@Ellahinator
Copy link
Author

I have solcjs since I am using windows.

solcjs --version
0.7.6+commit.7338295f.Emscripten.clang

@elopez
Copy link
Member

elopez commented Mar 22, 2022

Yeah, that won't work unfortunately. It expects solc to be installed. I haven't tried but if you grab and install solc.exe from the compiler releases it should work. Otherwise you can install solc-select beta which has Windows support and hopefully that other use case will work: pip3 install "solc-select>=v1.0.0b1" and then solc-select use 0.7.6 --always-install

@Ellahinator
Copy link
Author

It works! Thank you so much! You have been extremely helpful :D

@elopez
Copy link
Member

elopez commented Mar 22, 2022

That's great to hear! I'm glad I could help. I'll keep this open until the changes are merged, but this should be resolved now 👍

@elopez
Copy link
Member

elopez commented Apr 21, 2022

Slither 0.8.3 and crytic-compile 0.2.3 have now been released 🎉

@elopez elopez closed this as completed Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants