nodeshift-archived / license-reporter

license-reporter is a tool that gathers licenses for project's dependencies and produces a output in XML, JSON, YAML and HTML format.
Apache License 2.0
13 stars 10 forks source link

[Error: charData should not contain characters not allowed in XML] #84

Closed grdryn closed 7 years ago

grdryn commented 7 years ago

When I try to run license-reporter --file license.xml --all against the following Node.js project (note for reproduction, that it's a subdir of the repo, rather than the root):

https://github.com/feedhenry/fh-messaging/tree/master/fh-messaging

I get the following error, and no other output on stdout or the license.xml file that I specified in the command:

$ license-reporter --file license.xml --all
[Error: charData should not contain characters not allowed in XML]
danbev commented 7 years ago

@grdryn I was not able to successfully reproduce this issue exactly. But I did see an error when running the tool against fh-messaging. Are you in a position to try out the PR linked, or would you prefer to wait until I've merged and updated licence-reporter in the private npm repo?

What version of Node are you using? Just thought I'd try with the same version just in case.

grdryn commented 7 years ago

@danbev There's private npm repo? I've just been using master here and linking it :)

$ git rev-parse HEAD
87e2ef2487ffc3088f1d438075cb0a1883afbbd3

My Node.js version is 4.6.0 from nvm.

I'll try the linked PR and let you know if it gets any further 👍

danbev commented 7 years ago

There's private npm repo? I've just been using master here and linking it :)

Yeah, but just to make it easy for people that might not be comfortable with using npm link :)

$ npm install -g license-reporter --registry http://npm.skunkhenry.com
grdryn commented 7 years ago

@danbev unfortunately I still see the issue even with the linked PR.

After checking out your PR branch, I've got the following commit in the license-reporter repo:

$ git rev-parse HEAD
734211a89f1c4f02dde6af60f7d55f016f1d0994
$ npm install --production

I then re-cloned fh-messaging into /tmp in case there was anything odd in my main copy that was causing it.

cd /tmp/
git clone feedhenry/fh-messaging
cd fh-messaging/fh-messaging/
npm i --production

license-reporter --file license.xml --all
[Error: charData should not contain characters not allowed in XML]

# in case npm link was incorrect
~/src/bucharest-gold/licenser/bin/license-reporter --file license.xml --all
[Error: charData should not contain characters not allowed in XML]
danbev commented 7 years ago

@grdryn Ah sorry, I was not running this from the sub directory. I can reproduce it now and will take a closer look. Thanks

grdryn commented 7 years ago

@danbev if it helps, that error message seems to come from: node_modules/js2xmlparser/node_modules/xmlcreate/lib/nodes/XmlCharData.js. So here: https://github.com/michaelkourlas/node-xmlcreate/blob/master/src/nodes/XmlCharData.ts#L68..L71

danbev commented 7 years ago

@grdryn I've looked into this and the license file is node_modules/geoip/LICENCE which contains two ^L characters in it cause the issue you reported. I've opened this pr to see if we can get some feedback on the issue.