Open holdenmatt opened 11 months ago
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
@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"
},
@Deemoguse Thanks, that solved it for me!
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.
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
np
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