DEV Community

Discussion on: Dotfiles - Shell Config

 
rhamdeew profile image
Rail • Edited

I tried different options to learn how it works.

package.json located in /srv/projects/awesome-project/frontend/web/

gulp located in /srv/projects/awesome-project/frontend/web/node_modules/gulp/bin/

Run npx gulp --tasks

1) on /srv/projects/awesome-project/frontend/web/

[08:38:32] Tasks for /srv/projects/awesome-project/frontend/web/gulpfile.js
[08:38:32] ├── js
[08:38:32] ├── css
[08:38:32] └─┬ build
[08:38:32]   └─┬ <parallel>
[08:38:32]     ├── js
[08:38:32]     └── css

2) on /srv/projects/awesome-project/frontend

Of course it doesn't work.

[08:38:36] Local gulp not found in /srv/projects/awesome-project/frontend
[08:38:36] Try running: npm install gulp

3) on /srv/projects/awesome-project/frontend/web/js

[08:38:49] Working directory changed to /srv/projects/awesome-project/frontend/web
[08:38:52] Tasks for /srv/projects/awesome-project/frontend/web/gulpfile.js
[08:38:52] ├── js
[08:38:52] ├── css
[08:38:52] └─┬ build
[08:38:52]   └─┬ <parallel>
[08:38:52]     ├── js
[08:38:52]     └── css

4) on /srv/projects/awesome-project/frontend/web/js/dist

[08:39:07] Working directory changed to /srv/projects/awesome-project/frontend/web
[08:39:10] Tasks for /srv/projects/awesome-project/frontend/web/gulpfile.js
[08:39:10] ├── js
[08:39:10] ├── css
[08:39:10] └─┬ build
[08:39:10]   └─┬ <parallel>
[08:39:10]     ├── js
[08:39:10]     └── css

Result - npx searches for the node_modules directory in the parent directories and tries to run the binary from there.

Thread Thread
 
michaelcurrin profile image
Michael Currin

Neat