zkat / npx

execute npm package binaries (moved)

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check parent folders for package before requesting from npm

JBallin opened this issue · comments

$ mkdir npx_test && cd npx_test
$ npm init -y && npm i cowsay
$ mkdir cowsay && cd cowsay
$ npm init -y
$ npx cowsay
loading...

Is it possible to have npx go up the directories to see if a package is in node_modules? eslint seems to be able to do this for .eslintrc files.

$ npx eslint .
loading...
Cannot find module 'eslint-config-airbnb'
Referenced from: $PATH/.eslintrc.json

Use Case
I have a repo I use as a sandbox, it has things like mocha, chai, eslint installed in the parent folder. This works for me unless I have a local package.json in a folder, in which case I need to install the packages locally to use them.

This request describes what I assumed was the default behavior. Upward searching for packages is standard practice in the npm world. I'd really like to see this implemented as it would make working with monorepos such as the kind used with lernajs a bit easier.

I'm actually going to close this as I've learned that yarn's workspaces feature supports monorepos. Additionally I see that npm will support workspaces in v7.