Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify path(like npm --prefix) in npx?

Tags:

npm

npx

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!

like image 488
Adil Saju Avatar asked Aug 31 '25 21:08

Adil Saju


1 Answers

I managed to work around this problem by using

npm exec --prefix test_cases eslint
like image 185
kronn Avatar answered Sep 03 '25 17:09

kronn