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: cannot unmarshal bool into Go struct field error #1
Comments
I've submitted a pull request which addresses this issue. Feel free to use that code if your time is limited and need to quickly scan packages while the pull request is reviewed |
Thanks for your effort! I've tried to give it a go. It looks like I get the same errors as before: I am new to go language, maybe I am missing something. Anyway this is what I did: |
I'll take a look at this in a few hours, the npm parser is not the most robust and could definitely use some work so I may as well knock it all out at once. Thanks for providing example packages to test on. It's pretty strange that decamelize fails though as I was explicitly testing my pull request against the package.json file in the decamelize git repo. |
I'm looking at this as we speak. The decamelize
while the npm package.json documentation specifically defines the bundledDepencies to be an array of strings. |
I figured this might be the case. Main question now is whether this is common or if decamelize just breaks spec for no reason. If this is in fact a common occurrence then we can do some type checking before blindly adding to the PackageJSON struct |
@visma-henriklarsen could you provide us with other public packages which are also throwing this error? Also any information you may have about non-npm package managers that may have been used to generate |
@n0ncetonic and @joohoi I'm not a npm specialist, so I could be missing something trivial (I am more like devops). I lot of the packages.json files comes from our internal git repositories. It looks like some developers commited the entire node_modules tree at some point in our case. So it could be I am scanning older packages/versions of the packages, potentially superceed with updated ones that conform to the npm spec in the public repository. It's hard to say. I guess it is quite common scenario to not run on latest packages. In the attached zip file is a folder structure containing a subset of the packages.json files we are looking at. Also a powershell script used to scan the structure, plus a log file stating the output from confused.exe for each file. |
Thanks! I think the most important takeaway from this is (regardless of the package versions your dependency tree has) that npm packages can have inconsistencies in terms of file format in their respective In the context of this tool, the inconsistencies should not break & exit the tool, but work with whatever valid entries there might be, as it seems to be true for the |
Hi there
Thanks for a great tool!
We have checked a large number of package.json files. Sometimes the tool fails with this message:
Encountered an error while trying to read packages from file: json: cannot unmarshal bool into Go struct field PackageJSON.bundleDependencies of type []string
For instance when running against this file npm\node_modules\decamelize\package.json
I don't know if it's a general bug or something at our end.
Thanks!
The text was updated successfully, but these errors were encountered: