np: Package publishing partially fails when running tasks

Hi!

Love this tool. It’s been giving me some weird results recently. I tried publishing a brand new version of a scoped package:

image

After running, it looked like it had succeeded, even though it sat frozen on the version published message. After some seconds, the errors appeared and the application finished. The package was not published to npm.

Here is the package.json that was used.

The tail end of the execution:

image

Versions:

$ node --version && npm --version
v8.7.0
5.4.2

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 12
  • Comments: 48 (8 by maintainers)

Most upvoted comments

Is anyone able to look into this? Would it be worth creating a new issue instead to look towards supporting local installation rather than global? I won’t want np installed globally - I’d like it to be a part of the release process for every project. I usually document some command to run to either publish or deploy: npm run pub, npm run deploy etc. - I wouldn’t expect anyone to have to install any global packages.

EDIT: This issue also doesn’t seem to have anything to do with the Cleanup phase. Disabling that doesn’t fix the issue for me on any of my machines.

I can confirm this has been fixed in 2.16.1, thanks @mastilver.

@gonzofish This is the same thing that I’m experiencing. It definitely seems that the tasks carry on in the background, and crash later (as it seems the tests etc. start before the modules installations are completed).

This is reproducible for me every publish - so if there’s something I can try or information I can share, please let me know.

It seems some dependecy is broken.

As I mention earlier, rxjs is ‘broken’, a quick fix would be to freeze the version, but in the end we need to understand what’s happening…

@SamVerschueren @sindresorhus Would you accept a PR that freeze rxjs as a temporary fix?

the issue is with rxjs, I will try to find what the issue with it

I’m also seeing this issue. Here are the symptoms:

  • There’s an error having to do with execa that’s printed way after np “succeeds”.
  • The version printed in the success output is the existing version, not the newly published one.
  • The new version doesn’t actually get published.
  • The steps up to “Cleanup” run normally, but the steps after run all at once instantly.

For me this was due to how np cleans the node_modules folder.

As currently written, you must install np globally.

If you try to use it responsibly like you would for any other binary, you don’t install it globally. Instead, you add it in devDependencies and then reference it from there. The issue is that during the “Cleanup” phase I think np is removing itself, so everything after that doesn’t actually do anything (even though it says it succeeded).

If I remove it from devDependencies and install it globally with npm install --global np (even though I’m using yarn) it works.

This could be solved by making the cleanup phase smarter than just del('node_modules') to avoid deleting itself instead, which would be nice because things shouldn’t require being installed globally.

https://github.com/sindresorhus/any-observable tests are failing which is I think why np isn’t working

EDIT: I think I was testing it the wrong way, will investigate more later

I’m having the same issue

Latest version is from the 7th of June and I’m pretty sure I published several modules between now and then so my first thought is that it must come from a dependency that introduced a breaking change

@mastilver

@SamVerschueren @sindresorhus Would you accept a PR that freeze rxjs as a temporary fix?

Open a PR, and it will get merged pretty quickly. Make sure to reference this issue in the description.

As I mention earlier, rxjs is ‘broken’

Thanks. For me, it looked like that all npm exec command was not handled correctly and was not waiting the end of the command. I’ve tried to downgrade rxjs dependency to 5.4.3 and it works. Any 5.5 versions don’t work. I have a private registry so I will use it, waiting the fix upstream.

Same problem here.

  1. after changing that version number from old to new, it will still show the successful message as old ver published

  2. will tag but won’t publish since always ends with error because of the promise issue which like above, I use jest though