zkat / npx

execute npm package binaries (moved)

Home Page:https://github.com/npm/npx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Won't traverse to parents if dir has package.json?

jnardone opened this issue · comments

commented

We hoist all our common deps to the top-level parent, as well as common utilities (jest, eslint, pm2, etc.)

However, many of the child folders have their own package.json for one reason or another. (version strings, main: declaration, etc.)

npx won't traverse past the current directory, but only if it has a package.json. (This was reported and then closed in #210)

Example tree:

/package.json
/node_modules
/node_modules/.bin/foo
/packages
/packages/bar
/packages/bar/package.json

I should be able to, in packages/bar, call npx foo and have it resolve. This is expected behavior. But it won't.

If packages/bar does NOT have a package.json, npx foo will resolve to the correct in 2 parents up.