npm / npm/cli

[BUG] the output of the publish and postpublished are mixed up

Open
#4,861 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage Release 8.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Is there an existing issue for this?
  • I have searched the existing issues
This issue exists in the latest npm version
  • I am using the latest npm
Current Behavior

The upload bar of the publish script keeps being updated while the postpublish scripts are running, resulting in garbled output:

Here's a sample starting with four lines of adequate output then the rest where the progress bar is mixed with the postpublish output:

npm notice total files:   19
npm notice
npm notice Publishing to https://registry.npmjs.org/
(⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂) ⠼ : notice Publishing to https://registry.npmjs.org/
> compose-regexp@0.6.13 postpublish
> node ./scripts/postpublish.js && npm install && gosub test

(node:82564) ExperimentalWarning: Importing JSON modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
$ git tag v0.6.13
$ git push --tags

[... snip ...]

found 0 vulnerabilities
(⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂) ⠴ : notice Publishing to https://registry.npmjs.org/
> compose-regexp@0.6.13 test
> gosub build-regexp && ospec

(⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂) ⠴ : notice Publishing to https://registry.npmjs.org/
> compose-regexp@0.6.13 build-regexp
> node scripts/build-regexp.js

––––––⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂) ⠴ : notice Publishing to https://registry.npmjs.org/
All 714 assertions passed (old style total: 714)
+ compose-regexp@0.6.13
pygy@Albert2 compose-regexp.js %
Expected Behavior

postpublish should start when publish is done.

Steps To Reproduce

Create a package with a postinstall script that prints to stdout, run npm publish.

Environment
  • npm: v8.9.0
  • Node.js: v17.8.0
  • OS Name: MacOS
  • System Model Name: MacBook Air
  • npm config:
; "user" config from /Users/pygy/.npmrc

//registry.npmjs.org/:_authToken = (protected)

; node bin location = /usr/local/bin/node
; node version = v17.8.0
; npm local prefix = /Users/pygy/dev/compose-regexp.js
; npm version = 8.9.0
; cwd = /Users/pygy/dev/compose-regexp.js
; HOME = /Users/pygy
; Run `npm config ls -l` to show all defaults.```

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 reproducing the issue with npm publish on a package whose postpublish script writes to stdout, using the environment details in the report. Trace the publish progress output and lifecycle-hook ordering. Done means the publish progress output finishes before postpublish begins, without mixed or garbled output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.