-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
misleading error: Cannot find package '.../package.json', when package.json exists #49674
Comments
Also interesting note: it doesn't raise an error if there's a So the problem is really not the package.json not being findable, or the folder not being findable, but the package at |
in master build
|
Please see #49728 |
this is truly misleading |
I just ran into this slightly cryptic message with a module-only package build. For future reference: "exports": {
".": {
"import": "./dist/module.js",
"require": "./dist/module.js"
}
}, fixes it for such a package. |
Version
>=20.5.0
Platform
Darwin moxy.lan 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 arm64
Subsystem
modules
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Happens when a package.json exists, in a package folder that exists, but which does not define a main or
'.'
export.What is the expected behavior? Why is that the expected behavior?
The previous behavior was:
However, this is also not great, because it implies that the folder could not be found, when it clearly can be found.
What do you see instead?
Additional information
The confusing bit is that it's saying it can't "find" the package.json file, which clearly does exist and is a valid package.json (albeit not one that defines a valid importable package).
A better error message would be something like:
The text was updated successfully, but these errors were encountered: