npm / npm/cli

Question on Postinstall Order Change from npm 6 to npm 7

Open
#6,421 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

In npm 6, the postinstall order execution was based on the dependency tree. In npm 7+, the postinstall order of the dependencies is sort order. Why did this postinstall order execution change?

We move files around in the postinstall script. We need deepest dependence postinstall's to run first. In npm 7+, the sort order execution of postinstall breaks our workflow and usage of npm. I am assessing what direction we should go next.

NPM 6 - correct order

npm info lifecycle @deere-embedded/v@1.0.0~postinstall: @deere-embedded/v@1.0.0
npm info lifecycle @deere-embedded/b@1.0.0~postinstall: @deere-embedded/b@1.0.0
npm info lifecycle @deere-embedded/h@1.0.0~postinstall: @deere-embedded/h@1.0.0
npm info lifecycle @deere-embedded/u@1.0.0~postinstall: @deere-embedded/u@1.0.0

NPM 7, 8, and 9 - incorrect order. Sort order

182 info run @deere-embedded/b@1.0.0 postinstall node_modules/@deere-embedded/b move-library --verbose true
185 info run @deere-embedded/h@1.0.0 postinstall node_modules/@deere-embedded/h move-library --verbose
188 info run @deere-embedded/u@1.0.0 postinstall node_modules/@deere-embedded/u move-library --verbose
191 info run @deere-embedded/v@1.0.0 postinstall node_modules/@deere-embedded/v move-library --verbose

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing npm 6 with npm 7, 8, and 9 using the postinstall output and dependency sequence shown in the issue. Determine whether the ordering change is intended and whether dependency-tree ordering can be restored. Done means documenting the reason for the change and a practical direction for the reported workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.