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

yalc publish error in monorepo, "path" argument must be string #101

Closed
MitchPierias opened this issue Sep 23, 2019 · 7 comments
Closed

yalc publish error in monorepo, "path" argument must be string #101

MitchPierias opened this issue Sep 23, 2019 · 7 comments

Comments

@MitchPierias
Copy link

MitchPierias commented Sep 23, 2019

I'm receiving a "path" error when running yalc publish --private from within a monorepo setup.

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined

Exception

(node:5644) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:125:11)
    at Object.join (path.js:1147:7)
    at Object.<anonymous> (/Users/mitch/.config/yarn/global/node_modules/yalc/src/copy.js:95:47)
    at step (/Users/mitch/.config/yarn/global/node_modules/yalc/src/copy.js:43:23)
    at Object.next (/Users/mitch/.config/yarn/global/node_modules/yalc/src/copy.js:24:53)
    at /Users/mitch/.config/yarn/global/node_modules/yalc/src/copy.js:18:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/mitch/.config/yarn/global/node_modules/yalc/src/copy.js:14:12)
    at Object.exports.copyPackageToStore (/Users/mitch/.config/yarn/global/node_modules/yalc/src/copy.js:87:63)
    at Object.<anonymous> (/Users/mitch/.config/yarn/global/node_modules/yalc/src/publish.js:79:45)
(node:5644) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:5644) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Environment

MacOSX: 10.14.6
Node: 10.16.2
Yarn: 1.17.3
Yalc: 1.0.0-pre.34

@wclr
Copy link
Owner

wclr commented Sep 23, 2019

What is --private?

@MitchPierias
Copy link
Author

MitchPierias commented Sep 23, 2019

@whitecolor yalc publish on a monorepo using yarn workspaces (packages set to private) outputs

Will not publish package with `private: true` use --private flag to force publishing.

So I ran with --private

yalc publish --private

And received the "path" error

@MitchPierias
Copy link
Author

Error was because version was not specified in package.json which cause the path construction to fail in the copy script.

Validation needed for required version and name fields within the copyPackageToStore() function in copy.ts

@slikts
Copy link

slikts commented Feb 25, 2020

I ran into this because the version property isn't used when publishing with semantic-release.

@slikts
Copy link

slikts commented Mar 6, 2020

Ran into this again with a different package and had to go through googling again. This issue shouldn't be closed.

@danielcnascimento
Copy link

I tried to add any version, as mentioned above, but it still doesn't work.

@samhh
Copy link

samhh commented Feb 28, 2023

As of Yalc 1.0.0-pre.53, in an ordinary repo:

  • Without neither name nor verson: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
  • With only name: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
  • With only version: Package manifest path/to/package.json should contain name and version.
  • With both name and verson: Works.

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