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

WordPress Trac noreply at wordpress.org
Sun Apr 6 10:49:56 UTC 2025


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

Comment (by jtquip88):

 @SirLouen Thanks for testing this.
 Since there were no duplicates to begin with, it's expected that this
 patch wouldn’t cause any differences. The patch doesn’t materially change
 how we fetch and structure dependencies—it simply ensures that local
 .npmrc settings are honored. This means that if there were duplicates,
 they would now be deduplicated due to the prefer-dedupe=true setting in
 .npmrc.

 Regarding this error:

 {{{
 TypeError: Cannot convert undefined or null to object:
 }}}

 I didn’t include a fix for this because I assumed we’d want to investigate
 and address it separately. This error occurs because the parsing logic
 expects "dependencies" to be a top-level property in package-lock.json.
 However, in newer versions of npm (v7+), dependencies are nested under
 individual packages within the "packages" section.

 Until npm v6, the "dependencies" field was indeed a top-level property.
 This structural change likely means the issue has existed for a while but
 remained unnoticed.

 Next steps:
 If we still want to keep the version conflict resolution logic, we could
 rewrite it to support the new structure in package-lock.json. I’m happy to
 take that on—just wanted to align with the team here first If we want to
 fix it or just suppress the error.
 cc @desrosj

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


More information about the wp-trac mailing list