Socket
Socket
Sign inDemoInstall

find-node-modules

Package Overview
Dependencies
21
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    find-node-modules

Return an array of all parent node_modules directories


Version published
Weekly downloads
958K
increased by0.91%
Maintainers
1
Install size
389 kB
Created
Weekly downloads
 

Readme

Source

find-node-modules

This is a little node module to find the path of every parent node_modules directory. It's useful for things like Sass, where you can't specify the exact path to individual modules (in which case findup-sync would be sufficient), and you can't just give an array of parent node_modules which might exist, because it will error if they don't.

In most cases you're trying to find node_modules directories, findup-sync should be sufficient. This library is specifically for if you want an array containing all the parent node_modules paths. If you loop through the output of this library, you should be using findup-sync instead.

Install

$ npm install --save find-node-modules

Usage

var findNodeModules = require('find-node-modules');

findNodeModules();
//=> ['node_modules', '../../node_modules']

findNodeModules({ cwd: './someDir' });
//=> ['../node_modules', '../../../node_modules']

findNodeModules('./someDir');
//=> ['../node_modules', '../../../node_modules']

findNodeModules({ cwd: './someDir', relative: false });
//=> ['/path/to/something/node_modules', '/path/node_modules']

License

This is released under the MIT license.

FAQs

Last updated on 01 Mar 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc