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

JSON::ParseError running licenced list #430

Closed
pfeffer opened this issue Jan 7, 2022 · 3 comments · Fixed by #431
Closed

JSON::ParseError running licenced list #430

pfeffer opened this issue Jan 7, 2022 · 3 comments · Fixed by #431

Comments

@pfeffer
Copy link

pfeffer commented Jan 7, 2022

One of the packages we're using has a malformed package.json as a test fixture, and now running licenced (v3) results in an error, since it's looping over all of the package.json under node_modules here - https://github.com/github/licensed/blob/master/lib/licensed/sources/yarn/v1.rb#L79.

here is the full backtrace:

Listing dependencies for ****
  yarn
  * 0 yarn dependencies
Traceback (most recent call last):
	31: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/bin/licensed:23:in `<main>'
	30: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/bin/licensed:23:in `load'
	29: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/exe/licensed:5:in `<top (required)>'
	28: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/thor-1.1.0/lib/thor/base.rb:485:in `start'
	27: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
	26: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
	25: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
	24: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/cli.rb:43:in `list'
	23: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/cli.rb:110:in `run'
	22: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/commands/command.rb:23:in `run'
	21: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/commands/command.rb:64:in `run_command'
	20: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/commands/command.rb:64:in `map'
	19: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/commands/command.rb:67:in `block in run_command'
	18: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/commands/command.rb:95:in `run_app'
	17: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/commands/command.rb:95:in `chdir'
	16: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/commands/command.rb:98:in `block in run_app'
	15: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/commands/command.rb:98:in `map'
	14: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/commands/command.rb:101:in `block (2 levels) in run_app'
	13: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/commands/command.rb:136:in `run_source'
	12: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/sources/source.rb:67:in `dependencies'
	11: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/sources/source.rb:84:in `cached_dependencies'
	10: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/sources/yarn/v1.rb:21:in `enumerate_dependencies'
	 9: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/sources/yarn/v1.rb:39:in `packages'
	 8: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/sources/yarn/v1.rb:59:in `recursive_dependencies'
	 7: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/sources/yarn/v1.rb:59:in `each'
	 6: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/sources/yarn/v1.rb:69:in `block in recursive_dependencies'
	 5: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/sources/yarn/v1.rb:79:in `dependency_paths'
	 4: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/sources/yarn/v1.rb:79:in `each_with_object'
	 3: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/sources/yarn/v1.rb:79:in `each'
	 2: from /__enclose_io_memfs__/lib/ruby/gems/2.6.0/gems/licensed-3.4.0/lib/licensed/sources/yarn/v1.rb:81:in `block in dependency_paths'
	 1: from /__enclose_io_memfs__/lib/ruby/2.6.0/json/common.rb:156:in `parse'
/__enclose_io_memfs__/lib/ruby/2.6.0/json/common.rb:156:in `parse': 767: unexpected token at '{ (JSON::ParserError)

I'm struggling to find a workaround here, any help is appreciated!

@jonabc
Copy link
Contributor

jonabc commented Jan 7, 2022

Thanks for the report @pfeffer 🙇 . I'll take a look and see if I can put out a fix ASAP. It's a little strange that the package installation includes the packages test fixtures though 😕

@jonabc
Copy link
Contributor

jonabc commented Jan 8, 2022

Licensed 3.4.1 was just released which should resolve this. Please reopen if you continue to see problems 🙏

@pfeffer
Copy link
Author

pfeffer commented Jan 8, 2022

Thank you so much for the prompt response! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants