Make WordPress Core

Opened 18 months ago

Closed 18 months ago

Last modified 18 months ago

#56547 closed defect (bug) (fixed)

Prevent using npm 7 until gutenberg supports it

Reported by: jorbin's profile jorbin Owned by: jorbin's profile jorbin
Milestone: 6.1 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: good-first-bug has-patch
Focuses: Cc:

Description

Since https://github.com/WordPress/gutenberg/pull/29204, gutenberg has required NPM 6. As much of WordPress depends on JS from there, we should match NPM requirements

Attachments (1)

npmversion.diff (530 bytes) - added by rcorrales 18 months ago.

Download all attachments as: .zip

Change History (6)

#1 @rcorrales
18 months ago

I attached a patch that limits the npm version to 6 and sets engine-strict = true in .npmrc so it stops the installation if the version is not supported.

#2 @rcorrales
18 months ago

You can test this fix by installing a version > 6:

npm i -g npm@7

Then, when you would get this error when running npm install:

npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: WordPress@6.1.0
npm ERR! notsup Not compatible with your version of node/npm: WordPress@6.1.0
npm ERR! notsup Required: {"node":">=14.15.0","npm":">=6.14.8 <7"}
npm ERR! notsup Actual:   {"npm":"7.24.2","node":"v16.13.0"}

This ticket was mentioned in PR #3232 on WordPress/wordpress-develop by aaronjorbin.


18 months ago
#3

  • Keywords has-patch added

#4 @jorbin
18 months ago

  • Owner set to jorbin
  • Resolution set to fixed
  • Status changed from new to closed

In 54124:

Build/Test: Prevent using unsupported NPM versions.

Using NPM 7+ currently causes a number of issues. In order to improve developer experience, we should prevent a developer from going down the road of using incompatible engines.

See also: https://github.com/WordPress/gutenberg/pull/29204 and https://github.com/WordPress/gutenberg/pull/23600.

Props rcorrales.
Fixes #56547.

Note: See TracTickets for help on using tickets.