webscopeio / license.sh

License checker tool - We're in a beta phase, any help is appreciated, especially reporting issues
https://webscopeio.github.io/license.sh
MIT License
40 stars 6 forks source link

Fatal error when using both NPM and YARN #87

Closed jozefhruska closed 4 years ago

jozefhruska commented 4 years ago

I have a project that's using both NPM and YARN (not used anymore, packages not installed, we just forgot to delete the yarn.lock file).

After I removed yarn.lock file it worked.

Maybe it could handle the error with better UX?

Traceback (most recent call last):
  File "/usr/local/bin/license-sh", line 2, in <module>
    from license_sh import __main__
  File "/usr/local/lib/python3.7/site-packages/license_sh/__main__.py", line 25, in <module>
    run_license_sh(arguments)
  File "/usr/local/lib/python3.7/site-packages/license_sh/commands/run_license_sh.py", line 69, in run_license_sh
    dep_tree, license_map = runner.check()
  File "/usr/local/lib/python3.7/site-packages/license_sh/runners/yarn/__init__.py", line 336, in check
    package_map = parse_yarn_lock(get_yarn_lock_json(self.directory))
  File "/usr/local/lib/python3.7/site-packages/license_sh/runners/yarn/__init__.py", line 70, in get_yarn_lock_json
    stderr=subprocess.PIPE,
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
4rokis commented 4 years ago

This is connected to the #78

We are currently expecting only one package manager. If more is present, the latest specified in code is used. In your example old yarn is used. However as the yarn.lock is old and not actual, script fails.

We mainly need to update error messages

4rokis commented 4 years ago

Addressed in #95

jankoritak commented 4 years ago

Shall we close this one? @S4n60w3n

4rokis commented 4 years ago

You have now option to pick what package manager you want. IMHO we can close it