Skip to content

Comments

Fix build with npm@11.8.0#6760

Open
romaricpascal wants to merge 2 commits intomainfrom
relax-npm-version-requirement
Open

Fix build with npm@11.8.0#6760
romaricpascal wants to merge 2 commits intomainfrom
relax-npm-version-requirement

Conversation

@romaricpascal
Copy link
Member

@romaricpascal romaricpascal commented Feb 20, 2026

Move optionalDependencies into devDependencies as it leads to sub-dependencies of the optionalDependencies not to be listed inside package.json, which makes npm@11.8.0 unable to run npm ci.

This should also help with Dependabot hoisting some optional dependencies in the package-lock.json file.

Also tidies up the required versions in our engines field of package.json to keep a wide range of version available to facilitate contribution.

Why

We had a couple of CI fails from Dependabot updates:

These updates try to install our project using npm@11.8.0 where our engines field
in package.json specifies npm@11.6.2 (as an exact version).

PRs not updating package.json and package-lock.json seem unaffected (for now), so benefit from the cached dependencies on CI.

Thanks @colinrotherham for pointing out that freezing the version numbers wasn't a good idea and pointing me in the right direction for the fix.

@romaricpascal romaricpascal requested a review from a team as a code owner February 20, 2026 14:24
@romaricpascal romaricpascal marked this pull request as draft February 20, 2026 14:24
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-6760 February 20, 2026 14:24 Inactive
@colinrotherham
Copy link
Contributor

colinrotherham commented Feb 20, 2026

You'll want to do this @romaricpascal

  1. Update all packages using npm update --save
  2. Manually revert unwanted package.json changes then npm install
  3. Consolidate optionalDependencies into devDependencies (resolving issue)
  4. Run npm install
  5. Run npm dedupe just in case

I've tried it on my fork and it's all working

No more automatically added or removed packages:
main...colinrotherham:govuk-frontend:main

Install steps for Linux and Windows all working:
https://github.com/colinrotherham/govuk-frontend/actions/runs/22228493349
https://github.com/colinrotherham/govuk-frontend/actions/runs/22232189755

☝️ Some TypeScript and Stylelint issues from the updated packages will need fixing though

@github-actions
Copy link

github-actions bot commented Feb 20, 2026

📋 Stats

No changes to any distributed file sizes!


Action run for ef4ffcb

The separation causes issues for Dependabot which hoists some dependencies,
and leads to missing sub-dependencies in the `package-lock.json` (like `@octokit/core`),
which cause npm 11.8.0 not to be able to run `npm ci`.

Regrouping the `optionalDependencies` into `devDependencies` solves the issue with npm 11.8.0,
and shouldn't have any adverse effect as we don't use `--omit=optional` anywhere I could see.
The strict version causes issues on GitHub CI when running on Windows,
as we require a strict 11.6.2 version but the installed version is 11.8.0:
- https://github.com/alphagov/govuk-frontend/actions/runs/22199182869/job/64207330184?pr=6756
- https://github.com/alphagov/govuk-frontend/actions/runs/22193376028/job/64187136429?pr=6755

The pinned version also did not match the minimum Node version as Node 24.11.0 installs with npm 11.6.1.

We do want to [skip 11.6.3](#6455)
which has issues with the `overrides` field of `package.json`
@romaricpascal romaricpascal force-pushed the relax-npm-version-requirement branch from bdf4836 to ef4ffcb Compare February 20, 2026 16:50
@romaricpascal romaricpascal changed the title Relax version requirements for npm Fix build with npm@11.8.0 Feb 20, 2026
@romaricpascal romaricpascal marked this pull request as ready for review February 20, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants