[wp-trac] [WordPress Trac] #62839: sync-gutenberg-packages script is not respecting .npmrc file

WordPress Trac noreply at wordpress.org
Wed Jul 2 19:57:48 UTC 2025


#62839: sync-gutenberg-packages script is not respecting .npmrc file
-------------------------------------+-----------------------
 Reporter:  desrosj                  |       Owner:  (none)
     Type:  defect (bug)             |      Status:  reopened
 Priority:  normal                   |   Milestone:  6.9
Component:  Build/Test Tools         |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch has-test-info  |     Focuses:
-------------------------------------+-----------------------
Changes (by desrosj):

 * keywords:  has-patch reporter-feedback needs-test-info close => has-patch
     has-test-info


Comment:

 Thanks for the PR @jtquip88.

 The PR looks like it should fix the issue. But I'm having trouble
 confirming because I'm still seeing duplicates.

 For anyone looking to test, this expands on my originally listed steps and
 is probably the best process to follow outside of actually using the
 script to apply updates:
 - Create a branch. This can be from `trunk` or a recent version like `6.7`
 (I don't think `6.8` will have any updates currently).
 - Run `npm dedupe` (`--verbose` will give you more detail, but is not
 required).
 - Commit any changes that result. You now have a clean, deduped lock file.
 - Run `npm run sync-gutenberg-packages`. If you used a branch (say `6.7`),
 then you will need to include ` -- --dist-tag=wp-<VERSION>` where
 `VERSION` represents the major branch you are attempting to update (more
 documentation on the script itself can be found in the
 [https://make.wordpress.org/core/handbook/about/release-cycle/block-
 editor-release-process-for-major-releases/#package-updates-and-core-
 patches block editor handbook]).
 - Run `npm run post-sync-gutenberg-packages`.
 - Commit any changes to your branch. You now have an updated branch
 containing the latest changes for that WP major version.
 - Run `npm dedupe` again.

 Before the patch, this should result in new changes to the package lock
 file. This demonstrates that the `prefer-dedupe` option in the `.npmrc`
 file is not respected.

 I am currently unable to reproduce the issue when using `trunk` to test
 without the PR, even though there are package updates that are applied.

 However, I was able to reproduce when using the `6.7` branch and `npm run
 sync-gutenberg-packages -- --dist-tag=wp-6.8` (note updating to the next
 major branch) and the PR did not fix the problem when rerunning.

 A note about what duplicates means in this context to clarify. Running
 `npm dedupe` attempts to reduce duplication within the package tree stored
 within the `package-lock.json` file. So it's not that packages will be
 listed twice in `package.json`, but rather once (or as few times as
 possible) within `package-lock.json`. These changes will be really hard to
 notice on manual review because the lock file is over 37K lines. The best
 way to notice any changes would be running `git diff`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62839#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list