lerna ERR! lerna ENOENT: no such file or directory open `package.json`
See original GitHub issueWhen attempting to publish through Lerna I’m getting this error after creating a new release version number and after Lerna has pushed tags (lerna run build && lerna publish --contents dist
). Lerna is building and publishing each package as it always has for me but this new package is halting the entire process since it can’t find package.json
. When I run npm pack
on this package the generated files has a package.json
so I’m not sure why my Lerna set up isn’t able to access package.json
.
This issue is due to my lack of package publishing and I’m hoping to get a better understanding of it while figuring this out.
Generally speaking, when a bundler (webpack, rollup, etc) bundles src files and outputs them into an out directory (.dist/
in my case) does package.json get pulled into those out files as well when executing a build? (using rollup, not sure what magic is really happening)
Your Environment
Using rollup.js to bundle this package.
Executable | Version |
---|---|
lerna --version |
3.16.4 |
npm --version |
6.12.0 |
yarn --version |
1.7.0 |
node --version |
v12.13.0 |
OS | Version |
---|---|
NAME | VERSION |
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
No, the
--contents
option is a dirty hack for people who insist they need to recreate the entire package structure in a subdirectory. A traditionaldist
directory that you point to in your package.json’smain
(ormodule
) field absolutely does not require--contents
to be employed.Just omit it entirely, and you’ll be fine. I’ve published literally thousands of versions of hundreds of packages that use transpiled output (with Rollup, Babel, or Webpack) without ever needing to use
--contents
withlerna publish
.Hi Folks 👋
You will have seen in our message above that we at Nrwl are working really hard to bring the lerna repo up to date with what matters most to its community in June 2022.
As previously stated in that message, because we have not heard from the original author of this issue within the last 14 days, we are now automatically closing it.
If any users, including the original author, are still impacted by this issue then we still want to hear from you!
All we ask is that you first update to the latest lerna (
5.1.4
at the time of writing) to make sure it is still reproducible, and then fill out one of our new issue templates, providing all the requested details which apply to your situation:https://github.com/lerna/lerna/issues/new/choose
Many thanks again! 🙏
P.S. Over and above getting to grips with the repo, we have also been hard at work launching a new website, resolving all vulnerabilities, merging exciting new features and reigniting community PR contributions! 🚀
You can read our recent blog post to learn more about what we’ve been up to: https://blog.nrwl.io/lerna-5-1-new-website-new-guides-new-lerna-example-repo-distributed-caching-support-and-speed-64d66410bec7