Skip to content
This repository has been archived by the owner on Apr 7, 2021. It is now read-only.

[QUESTION] Is there support for following module resolution paths? #24

Open
arciisine opened this issue Nov 17, 2019 · 3 comments
Open

Comments

@arciisine
Copy link

What / Why

I'm currently running into an issue, with a monorepo, in that I want npx to pick up the executable in the parent directory, instead of just looking at the current directory. I'm not sure if I'm missing something, but running npx eslint in the sub package folder of the monorepo cannot find eslint in the parent node_modules directory.

The node Module documentation, https://nodejs.org/api/modules.html, specifies the load order for modules, including parents. Executing require.resolve.paths('') should return the list of all available paths that are searched on a require.

Where

This should be how require operates currently today.

@JoeAlamo
Copy link

I'm in same situation

Please see
zkat/npx#210
zkat/npx#222

@charlie-axsy
Copy link

Assuming you're like me and bumping into problems with Lerna hoisting into a root level .bin directory. I wonder if Lerna itself should be creating symlinks in the package/node_modules/.bin rather than assuming tooling will look upwards to find binaries

@charlie-axsy
Copy link

Aha, I found that Lerna was not symlinking eslint into my packageX/node_modules/.bin directories because it was not specified in "devDependencies". With the symlink in place, npx eslint now works as I expected, without trying to install eslint from the registry each time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants