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

Npm package should always have a main module #180

Closed
clayrisser opened this issue Apr 26, 2020 · 5 comments
Closed

Npm package should always have a main module #180

clayrisser opened this issue Apr 26, 2020 · 5 comments

Comments

@clayrisser
Copy link

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 running require.resolve('shx').

@nfischer
Copy link
Member

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.

@clayrisser
Copy link
Author

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".

@nfischer
Copy link
Member

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).

@nfischer
Copy link
Member

https://github.com/sindresorhus/clipboard-cli/blob/master/package.json is a CLI which does not support require'ing

@clayrisser
Copy link
Author

@nfischer ok thanks for the clarity.

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

2 participants