27

This is my folder structure:

project/
└── test_cases
    └── package.json

The working dir is project/. I want to run eslint (an npm package) from working dir. I dont wish to cd into test_case. I install the same package from work dir by
sudo npm install --prefix test_cases/.

Theres no such option for npx. npx eslint from working dir downloads from the internet. I want to run them from the test_cases dir. Help!

Adil Saju
  • 1,101
  • 3
  • 12
  • 26

2 Answers2

5

I managed to work around this problem by using

npm exec --prefix test_cases eslint
kronn
  • 925
  • 11
  • 31
-1

As mentioned in github issue in npm@7 and above you can specify --workspace option for this:

npx -w test_cases eslint

https://github.com/npm/npx/issues/74#issuecomment-676092733