sindresorhus / np

A better `npm publish`
MIT License
7.56k stars 299 forks source link

unable to publish package using Yarn -- cannot read properties of undefined (reading 'pipe') #698

Closed eswat2 closed 1 year ago

eswat2 commented 1 year ago

Description

  1. updated np to 8.0.1
  2. fixed a complaint about missing engines.node in package.json
  3. tried to publish a repo that uses np
➜  proto-tailwindcss-clrs git:(main) np patch

Publish a new version of proto-tailwindcss-clrs (current: 0.0.245, next: 0.0.246)

  ✔ Prerequisite check
  ✔ Git
  ✔ Installing dependencies using Yarn
  ✔ Running tests using Yarn
  ✔ Bumping version using Yarn
  ✖ Publishing package using Yarn
    → Cannot read properties of undefined (reading 'pipe')
    Pushing tags
    Creating release draft on GitHub

✖ Cannot read properties of undefined (reading 'pipe')

Aborted!

I tried using --verbose but it didn't give me any more information about the error...

Steps to reproduce

  1. clone the repo for this -- https://www.npmjs.com/package/proto-tailwindcss-clrs?activeTab=versions
  2. try to run np patch
  3. see the error ??

Expected behavior

it should publish a new version of the package using Yarn and then open the draft on GitHub...

Environment

np - 8.0.1 Node.js - 18.16.0 npm - 9.5.1 yarn - 1.22.19 Git - 2.40.1 OS - macOS Ventura 13.4 (22F66)

eswat2 commented 1 year ago

i ran np patch --preview and got this:

➜  proto-tailwindcss-clrs git:(main) np patch --preview

Publish a new version of proto-tailwindcss-clrs (current: 0.0.247, next: 0.0.248)

  ✔ Prerequisite check
  ✔ Git
  ✔ Installing dependencies using Yarn
  ✔ Running tests using Yarn
  ↓ Bumping version using Yarn [skipped]
    → [Preview] Command not executed: yarn version --new-version patch.
  ✖ Publishing package using Yarn
    → publish.getPackagePublishArguments is not a function
    Pushing tags
    Creating release draft on GitHub

✖ publish.getPackagePublishArguments is not a function

if i run yarn version --new-version patch, i see this:

➜  proto-tailwindcss-clrs git:(main) yarn version --new-version patch
yarn version v1.22.19
info Current version: 0.0.247
info New version: 0.0.248
✨  Done in 0.09s.

still not sure how to resolve this. It could very easily be a stupid user error... :)

mmkal commented 1 year ago

I saw the same thing without yarn - npm 9.5.0, node v18.15.0. I didn't do any debugging, because it had already messed up my repo's state by bumping the package.json version. I just switched to npm publish.

A suggestion to make this kind of thing easier to debug - write more verbose error logs (including a stack trace) to a .log file somewhere, and write the file path to stdout if something goes wrong? There's no good way to know what's wrong with a message like cannot read properties of undefined (reading 'pipe').

handlebauer commented 1 year ago

Running into this issue as well:

CleanShot 2023-05-29 at 15 34 08@2x

Tried to put a min repro together and encountered a separate problem:

CleanShot 2023-05-29 at 15 37 18@2x

... where that's just hanging indefinitely.

Appreciate the continued releases for this great tool. I'll stick to 7.x until things are resolved with this 👍 .

sindresorhus commented 1 year ago

It seems https://github.com/sindresorhus/np/commit/72879e0865bf044fb612a429a945922fe818654a forgot a return statement.

// @tommy-mitchell

sindresorhus commented 1 year ago

I tried using --verbose but it didn't give me any more information about the error...

https://github.com/sindresorhus/np/commit/12fce8869cc87ee859305cffd1a04aca7017a8b4

sindresorhus commented 1 year ago

https://github.com/sindresorhus/np/releases/tag/v8.0.2