Skip to content
This repository has been archived by the owner on Apr 7, 2021. It is now read-only.

[BUG] NODE_PATH environment variable is ignored #42

Open
repinvv opened this issue Feb 26, 2020 · 5 comments
Open

[BUG] NODE_PATH environment variable is ignored #42

repinvv opened this issue Feb 26, 2020 · 5 comments

Comments

@repinvv
Copy link

repinvv commented Feb 26, 2020

What / Why

Error message: "not found: gulp"

When

  1. setx NODE_PATH "my node_modules path"
  2. npx --no-install gulp myTask

Where

Windows, Node 12.16.1

Expected Behavior

gulp from NODE_PATH used

@repinvv repinvv changed the title [BUG] NODE_PATH variable is ignored [BUG] NODE_PATH environment variable is ignored Feb 26, 2020
@ljharb
Copy link

ljharb commented Feb 26, 2020

NODE_PATH is a legacy and deprecated way to require things. It has nothing to do with running a binary, or with your PATH, so npx should have zero interaction with it.

@repinvv
Copy link
Author

repinvv commented Feb 26, 2020

is there any other way to reference node_modules outside of working dir?

PS in documentation it is not marked as deprecated, https://nodejs.org/api/modules.html
and I checked that it works for running js files with node.

@ljharb
Copy link

ljharb commented Feb 26, 2020

It's deprecated in the sense that it's considered a bad practice to use it, and that while CJS has it, ESM never will - but it will never be removed from CJS either.

I'm a bit confused; you want to run gulp, as if it was in a project directory, but not in that project directory? Why?

@repinvv
Copy link
Author

repinvv commented Feb 26, 2020

I have a scenario where i have separate src folder and build folder. can't create/change files in src folder. Rules of our build system. So node_modules are installed or unpacked from zip into build folder. Wanted to avoid the extra step of copying everything from src folder to build folder, instead wanted to just reference that node_modules folder.

@ljharb
Copy link

ljharb commented Feb 27, 2020

I think that step is necessary, otherwise anything that deals with modules might need configuration.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants