You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get the following error when I try to run Licensed on my npm-based project. The error doesn't tell me what JSON file it's trying to parse, so it's pretty hard to diagnose/fix.
$ licensed list
Displaying dependencies for my-ui
npm dependencies:
/opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/json-1.8.6/lib/json/common.rb:155:in `initialize': A JSON text must at least contain two octets! (JSON::ParserError)
from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/json-1.8.6/lib/json/common.rb:155:in `new'
from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/json-1.8.6/lib/json/common.rb:155:in `parse'
from /Users/ips/.chefdk/gem/ruby/2.3.0/gems/licensed-1.0.1/lib/licensed/source/npm.rb:28:in `dependencies'
from /Users/ips/.chefdk/gem/ruby/2.3.0/gems/licensed-1.0.1/lib/licensed/command/list.rb:32:in `dependencies'
from /Users/ips/.chefdk/gem/ruby/2.3.0/gems/licensed-1.0.1/lib/licensed/command/list.rb:18:in `block (3 levels) in run'
from /Users/ips/.chefdk/gem/ruby/2.3.0/gems/licensed-1.0.1/lib/licensed/command/list.rb:15:in `each'
from /Users/ips/.chefdk/gem/ruby/2.3.0/gems/licensed-1.0.1/lib/licensed/command/list.rb:15:in `block (2 levels) in run'
from /Users/ips/.chefdk/gem/ruby/2.3.0/gems/licensed-1.0.1/lib/licensed/command/list.rb:14:in `chdir'
from /Users/ips/.chefdk/gem/ruby/2.3.0/gems/licensed-1.0.1/lib/licensed/command/list.rb:14:in `block in run'
from /Users/ips/.chefdk/gem/ruby/2.3.0/gems/licensed-1.0.1/lib/licensed/command/list.rb:12:in `each'
from /Users/ips/.chefdk/gem/ruby/2.3.0/gems/licensed-1.0.1/lib/licensed/command/list.rb:12:in `run'
from /Users/ips/.chefdk/gem/ruby/2.3.0/gems/licensed-1.0.1/lib/licensed/cli.rb:48:in `run'
from /Users/ips/.chefdk/gem/ruby/2.3.0/gems/licensed-1.0.1/lib/licensed/cli.rb:31:in `list'
from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /Users/ips/.chefdk/gem/ruby/2.3.0/gems/licensed-1.0.1/exe/licensed:5:in `<top (required)>'
from /Users/ips/.chefdk/gem/ruby/2.3.0/bin/licensed:22:in `load'
from /Users/ips/.chefdk/gem/ruby/2.3.0/bin/licensed:22:in `<main>'
The text was updated successfully, but these errors were encountered:
A more informative error message sounds like a great idea. if you'd like to open a PR fixing this that would be great. Otherwise I'm not sure when I'll have a chance to get to it.
Thanks for the reply. I ran that command and I got a bunch of errors on stderr. The errors appear to be because my package.json file is actually intended for yarn, and uses some syntax that is not npm-compatible. Note, I was able to parse the JSON from stdout without any errors using JSON.parse via node, so maybe Licensed is trying to parse both stdout+stderr, rather than only stdout, as JSON?
@ispringer Licensed only parses stdout, but intentionally does not use stdout from shell commands that exit with an error code. This avoids picking up information that might be incorrect or out of date if a CLI tool finds an error.
So it sounds like there are two things that would be helpful here
a yarn source that is different from the npm source that is being used
it looks like yarn.lock is the indicator that yarn is used in the local directory
a more helpful error message when the npm command fails or output can't be parsed.
I'll open a new issue to create a yarn source to track that request separately.
I get the following error when I try to run Licensed on my npm-based project. The error doesn't tell me what JSON file it's trying to parse, so it's pretty hard to diagnose/fix.
The text was updated successfully, but these errors were encountered: