Closed clayrisser closed 4 years ago
Why would you try to require shx? We intentionally don't support this case. If you want to require a library in your own code, you should use ShellJS.
I'm sure there are many reasons to require shx
aside from the reason why I need to. I need to find the path to the shx module, and require.resolve('shx')
is the way to do that, except it does not work without "main"
.
Why do you need the path to the module? Npm is responsible for adding the executable to the $PATH
, both for npm lifecycle scripts and for global installs (npm install -g
).
https://github.com/sindresorhus/clipboard-cli/blob/master/package.json is a CLI which does not support require
'ing
@nfischer ok thanks for the clarity.
The package.json is missing the
main
property. Because this is a cli, I understand why it was neglected, but it can create problems, for example if I am runningrequire.resolve('shx')
.