For some dependencies the license-checker crashes with a TypeError.
Description
In our case we are using the docosaurus plugin @scalar/docusaurus in the current version.
If we run the license-checker it crashes with the error:
TypeError: json.readme.toLowerCase is not a function
at flatten (node_modules/.pnpm/license-checker@25.0.1/node_modules/license-checker/lib/index.js:115:51)
Checked the line and made some debug:
if (json.path && (!json.readme || json.readme.toLowerCase().indexOf('no readme data found') > -1)) {
json.readme seems to be expected as a string, but for @scalar/docusaurus it contains
{
title: 'Scalar API Reference Plugin for Docusaurus',
badges: [
{ type: 'npm-version' },
{ type: 'npm-downloads' },
{ type: 'npm-license' }
],
documentation: 'https://scalar.com/products/api-references/integrations/docusaurus',
image: {
url: 'https://github.com/scalar/scalar/blob/main/integrations/docusaurus/docusaurus.png?raw=true',
altText: 'Screenshot of the Docusaurus integration'
}
}
which is not.
Expected Behavior
license-checker should not crash on any dependency
Actual Behavior
It crashes at least for @scalar/docusaurus
Possible Fix
Check if json.readme is a string.
Steps to Reproduce
use as package.json
{
"name": "crash-it",
"version": "1.0.0",
"private": true,
"dependencies": {
"@onebeyond/license-checker": "^2",
"@scalar/docusaurus": "^0"
}
}
and run
npm install
npx @onebeyond/license-checker --failOn MIT
Your Environment
- Version used: 2.2.0
- Environment name and version (e.g. Chrome 39, node.js 5.4): node 24.16.0
- Operating System and version (desktop or mobile): Ubuntu 22.04
For some dependencies the license-checker crashes with a TypeError.
Description
In our case we are using the docosaurus plugin
@scalar/docusaurusin the current version.If we run the license-checker it crashes with the error:
Checked the line and made some debug:
json.readmeseems to be expected as a string, but for@scalar/docusaurusit containswhich is not.
Expected Behavior
license-checker should not crash on any dependency
Actual Behavior
It crashes at least for
@scalar/docusaurusPossible Fix
Check if
json.readmeis a string.Steps to Reproduce
use as
package.json{ "name": "crash-it", "version": "1.0.0", "private": true, "dependencies": { "@onebeyond/license-checker": "^2", "@scalar/docusaurus": "^0" } }and run
Your Environment