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

Check license script fails in npm version 7.6.0 #29524

Closed
fluiddot opened this issue Mar 3, 2021 · 2 comments
Closed

Check license script fails in npm version 7.6.0 #29524

fluiddot opened this issue Mar 3, 2021 · 2 comments
Assignees
Labels
[Package] Scripts /packages/scripts [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended [Type] Build Tooling Issues or PRs related to build tooling
Projects

Comments

@fluiddot
Copy link
Contributor

fluiddot commented Mar 3, 2021

Description

Running the command npm run check-licenses in npm version 7.6.0 fails with the following error:

[1] undefined:1
[1]
[1]
[1]
[1] SyntaxError: Unexpected end of JSON input
[1]     at JSON.parse (<anonymous>)
[1]     at Object.<anonymous> (<WORKSPACE_DIR>/gutenberg/packages/scripts/scripts/check-licenses.js:188:21)
[1]     at Module._compile (internal/modules/cjs/loader.js:1063:30)
[1]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
[1]     at Module.load (internal/modules/cjs/loader.js:928:32)
[1]     at Function.Module._load (internal/modules/cjs/loader.js:769:14)
[1]     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
[1]     at internal/main/run_main_module.js:17:47
[1] wp-scripts check-licenses --dev exited with code 1
[0] undefined:1
[0]
[0]
[0]
[0] SyntaxError: Unexpected end of JSON input
[0]     at JSON.parse (<anonymous>)
[0]     at Object.<anonymous> (<WORKSPACE_DIR>/gutenberg/packages/scripts/scripts/check-licenses.js:188:21)
[0]     at Module._compile (internal/modules/cjs/loader.js:1063:30)
[0]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
[0]     at Module.load (internal/modules/cjs/loader.js:928:32)
[0]     at Function.Module._load (internal/modules/cjs/loader.js:769:14)
[0]     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
[0]     at internal/main/run_main_module.js:17:47
[0] wp-scripts check-licenses --prod --gpl2 --ignore=@react-native-community/cli,@react-native-community/cli-platform-ios exited with code 1

The error looks like it's related to the command npm ls that is used for fetching all the dependencies data.

I tried to run npm ls --json --all to check the output of that command and it's giving a lot of error like the following ones:

npm ERR! code ELSPROBLEMS
npm ERR! missing: sveltedoc-parser@^3.0.4, required by @storybook/addon-docs@6.1.11
npm ERR! missing: vue@^2.6.10, required by @storybook/addon-docs@6.1.11
npm ERR! missing: canvas@^2.5.0, required by jsdom@16.4.0
npm ERR! invalid: react-refresh@0.4.2 <WORKSPACE_DIR>/gutenberg/node_modules/react-refresh
...

Step-by-step reproduction instructions

  1. Install npm version 7.6.0 (you can run the command: npm install -g npm@7.6.0
  2. Remove <7 condition from the npm engine section of package.json file (example)
  3. Run npm run check-licenses
  4. Observe that the script fails

Expected behaviour

Running the script should succeed.

Actual behaviour

Running the script produces an error.

Screenshots or screen recording (optional)

N/A

Code snippet (optional)

WordPress information

  • WordPress version: N/A
  • Gutenberg version: 10.0.1
  • Are all plugins except Gutenberg deactivated? N/A
  • Are you using a default theme (e.g. Twenty Twenty-One)? N/A

Device information

  • Device: N/A
  • Operating system: N/A
  • Browser: N/A
@fluiddot
Copy link
Contributor Author

fluiddot commented Mar 9, 2021

I found this issue in npm/cli that describes a similar problem.

@gziolo gziolo added the [Package] Scripts /packages/scripts label Mar 16, 2021
@gziolo gziolo added this to To do in Core JS Mar 16, 2021
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Aug 5, 2021
@gziolo gziolo moved this from To do to In progress in Core JS Aug 5, 2021
@gziolo
Copy link
Member

gziolo commented Aug 12, 2021

As tested in #33892, it's no longer an issue with the most recent version of npm v7.

@gziolo gziolo closed this as completed Aug 12, 2021
@gziolo gziolo moved this from In progress to Done in Core JS Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Scripts /packages/scripts [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended [Type] Build Tooling Issues or PRs related to build tooling
Projects
No open projects
Core JS
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants