You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a user of pnpm, when I run pnpm install in a directory without a package.json, I would like for pnpm to remind me that I'm doing something silly, similarly to how npm install behaves.
Describe the solution you'd like
a useful error message
I would like for pnpm install to log that I'm doing something silly,
at the very least.
The current behavior is to output Already up-to-date. I suppose
it's true that everything is up-to-date in the sense that nothing
was done and there's nothing to install, but I doubt that there's
any use case (let alone a common use case) where that behavior is
what the user expects/wants.
Realistically, if a user is invoking pnpm install in a directory
without a package.json file, they've probably made a simple
mistake, and it would be benevolent of pnpm to point out this
mistake.
npm (tested with 6.32.9 and 8.5.0) and Ruby's bundler (tested with
2.2.3) both behave this way.
a non-zero exit code
I would also like for pnpm install to exit with a non-zero code, to
indicate the error more programmatically.
This would make enable code to fail fast, rather than wait for
something related to fail at some later point.
Ruby's bundler (tested with 2.2.3) and npm v8.x (tested with 8.5.0)
both behave this way.
Describe the drawbacks of your solution
This change is not necessarily trivial, as it's not good enough to
check for the existence of package.json in the current directory;
pnpm and npm both accept usages where package.json exists in a
parent directory. So, pnpm would need to do its usual thing of looking
for package.json, and then error/exit when it still hasn't found it.
I'm also unsure of how this change might relate to other pnpm
commands; are there any commands that can be sensibly run without package.json, or should (almost) all pnpm commands error if package.json can't be found?
a useful error message
I'm not sure what possible downsides there might be.
a non-zero exit code
Changing pnpm install to exit non-zero when there's no package.json would break backwards compatibility.
Describe alternatives you've considered
no change
In this case, it's the user's responsibility to check for package.json in either the current directory or any of its parent
directories.
only add the error message
This is a good start, but it still falls to the user to diagnose
failures programmatically. Since the exit code still says 'success,'
either further code would continue to run until something failed, or
the developer would have to diagnose the failure (either by looking
for a package.json, or by examining the error output) and then
explicitly cause a failure.
The text was updated successfully, but these errors were encountered:
Describe the user story
As a user of pnpm, when I run
pnpm install
in a directory without apackage.json
, I would like for pnpm to remind me that I'm doing something silly, similarly to hownpm install
behaves.Describe the solution you'd like
a useful error message
I would like for
pnpm install
to log that I'm doing something silly,at the very least.
The current behavior is to output
Already up-to-date
. I supposeit's true that everything is up-to-date in the sense that nothing
was done and there's nothing to install, but I doubt that there's
any use case (let alone a common use case) where that behavior is
what the user expects/wants.
Realistically, if a user is invoking
pnpm install
in a directorywithout a
package.json
file, they've probably made a simplemistake, and it would be benevolent of
pnpm
to point out thismistake.
npm (tested with 6.32.9 and 8.5.0) and Ruby's bundler (tested with
2.2.3) both behave this way.
a non-zero exit code
I would also like for
pnpm install
to exit with a non-zero code, toindicate the error more programmatically.
This would make enable code to fail fast, rather than wait for
something related to fail at some later point.
Ruby's bundler (tested with 2.2.3) and npm v8.x (tested with 8.5.0)
both behave this way.
Describe the drawbacks of your solution
This change is not necessarily trivial, as it's not good enough to
check for the existence of
package.json
in the current directory;pnpm and npm both accept usages where
package.json
exists in aparent directory. So, pnpm would need to do its usual thing of looking
for
package.json
, and then error/exit when it still hasn't found it.I'm also unsure of how this change might relate to other pnpm
commands; are there any commands that can be sensibly run without
package.json
, or should (almost) allpnpm
commands error ifpackage.json
can't be found?a useful error message
I'm not sure what possible downsides there might be.
a non-zero exit code
Changing
pnpm install
to exit non-zero when there's nopackage.json
would break backwards compatibility.Describe alternatives you've considered
no change
In this case, it's the user's responsibility to check for
package.json
in either the current directory or any of its parentdirectories.
only add the error message
This is a good start, but it still falls to the user to diagnose
failures programmatically. Since the exit code still says 'success,'
either further code would continue to run until something failed, or
the developer would have to diagnose the failure (either by looking
for a package.json, or by examining the error output) and then
explicitly cause a failure.
The text was updated successfully, but these errors were encountered: