question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`NODE_PATH` environment variable is ignored

See original GitHub issue

The “node require.resolve() algorithm” should also search in the directories listed in the $NODE_PATH environment variable, if it is set. See docs here: https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders

Currently, the resolve library does not implement this step, but I think it should.

I need this because I am running with my local node_modules directory outside of my project dir, as per this workaround, because my project dir does not support symlinks (a shared folder).

Because resolve ignores the $NODE_PATH environment variable, grunt refuses to run.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ljharbcommented, Sep 19, 2017

This is a duplicate of #39; see https://github.com/browserify/resolve/issues/39#issuecomment-306223854.

I wouldn’t suggest using NODE_PATH for anything; any workaround using it is worse than other alternatives.

0reactions
RichardBradleycommented, Sep 20, 2017

I have found a workaround which I think I can live with for now:

  1. Copy the project.json file to a temp folder on a different FS
  2. Run npm install there
  3. Copy the resulting node_modules directory back into the project dir, using cp -r --dereference to expand symlinks into copies.

Ah, I’m not familiar with HGFS; although NTFS certainly supports symlinks.

It does, but they’re not commonly used. I believe that the Windows installers for npm avoid creating symlinks for that reason. The problem for me is that I am running on Linux and the npm installers all assume that they are free to create symlinks.

Regarding the “file://” urls and “copy-on-install”, I don’t see how that’s relevant to my goal of running npm install on a node project that uses grunt on Linux when my filesystem doesn’t support symlinks, but I suspect we’re talking past each other on that one.

Thanks for your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - NODE_PATH is being ignored or not working
I'm trying to run my node app on a new server and am having some issues with the NODE_PATH environment variable. The app...
Read more >
Node.js – NODE_PATH is being ignored or not working
I'm trying to run my node app on a new server and am having some issues with the NODE_PATH environment variable. The app...
Read more >
Configuration - Quokka.js
This setting is ignored on non-Windows environments. If configuring a custom version of node , the path must refer to a version of...
Read more >
API - esbuild
The build API call operates on one or more files in the file system. ... Conditions; Drop; Entry names; Footer; Global name; Ignore...
Read more >
NodePath — Godot Engine (stable) documentation in English
A pre-parsed relative or absolute path in a scene tree, ... Exporting a NodePath variable will give you a node selection widget in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found