Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

np hangs while publishing #725

Open
holdenmatt opened this issue Dec 19, 2023 · 4 comments
Open

np hangs while publishing #725

holdenmatt opened this issue Dec 19, 2023 · 4 comments

Comments

@holdenmatt
Copy link

Description

np was working for me previously, but now when I publish a package the CLI hangs indefinitely on:
"Publishing package using npm"

When I check npm, the package is actually published, the CLI just never finished and needs to be aborted.
https://status.npmjs.org/ shows no issues.

Is there any workaround or way to see what it's stuck on?

Steps to reproduce

  1. Run np
  2. Make a new patch version
  3. Hangs forever

Expected behavior

The CLI finishes publishing and doesn't hang.

Environment

np - 9.2.0
Node.js - 20.9.0
npm - 10.1.0
OS - macOS 12.3.1

@aoifelee
Copy link

I also see it hang, on the "Publishing package using Yarn Berry" step. I just started using np today, so it never worked for me previously. Also, I do not see the published package in npm.

np - 9.2.0
node - 20.10.0
yarn - 4.0.2
OS - macOS 14.1.1

@Deemoguse
Copy link

Deemoguse commented Jan 3, 2024

@aoifelee, @holdenmatt I had the same problem and just now I was able to solve it. The problem was that in my package.json file had a publish script that was responsible for publishing the package. It was a mistake to give such a name for this script, because publish is one of the npm hooks that is executed after the package is published to the public.

Make sure that you haven't made the same mistake.

"scripts": {
	"eslint:fix": "eslint **/*.ts --fix --color",
	"build:prod": "rimraf dist & cross-env rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
	"build:test": "rimraf dist & cross-env MODE=test rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
	"test:modules": "jest --verbose --roots test/cases/modules",
	"test:integration": "jest --verbose --roots test/cases/integration",
	"test:perfomance": "jest --verbose --roots test/cases/perfomance",
	"test": "npm run build:test && npm run test:modules && npm run test:integration && npm run test:perfomance && rimraf dist",
-	"publish": "npm run test && npm run build:prod && np --no-tests"
+	"release": "npm run test && npm run build:prod && np --no-tests"
},

@PieterT2000
Copy link

@Deemoguse Thanks, that solved it for me!

@ericcarraway
Copy link

For me, the np command would hang indefinitely during the "Publishing package" step. I suspect the problem stemmed from my test script, which was inadvertently running in watch mode while publishing. To resolve this, I modified my npm scripts:

- "test": "vitest",
+ "test": "vitest run",
+ "test:dev": "vitest",

Adjusting the test command to vitest run now executes the tests once and exits, thus preventing the np command from hanging. I've added a test:dev script that retains the original watch mode functionality for development purposes.

This adjustment may help others experiencing similar issues with np hanging due to test scripts not terminating.

RobertSasak added a commit to RobertSasak/expo-watch that referenced this issue Aug 12, 2024
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

No branches or pull requests

5 participants