Socket
Socket
Sign inDemoInstall

npm-paths

Package Overview
Dependencies
6
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    npm-paths

Returns an array of NPM directory paths based on the user's platform and environment.


Version published
Weekly downloads
6.9K
increased by8.61%
Maintainers
1
Install size
80.2 kB
Created
Weekly downloads
 

Readme

Source

npm-paths NPM version NPM monthly downloads NPM total downloads Linux Build Status

Returns an array of NPM directory paths based on the user's platform and environment.

Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.

Install

Install with npm:

$ npm install --save npm-paths

This lib does not include the require.main.paths in the result array. If you do need the require.main.paths, use global-paths instead.

Usage

const paths = require('./');
console.log(paths());

// specify the CWD to start from
console.log(paths('some/directory'));

Example results

Results in something like the following:

Mac

// example was run from the "/Users/jonschlinkert/dev/npm-paths/" directory
[ '/Users/jonschlinkert/dev/npm-paths/node_modules',
  '/Users/jonschlinkert/dev/node_modules',
  '/Users/jonschlinkert/node_modules',
  '/Users/node_modules',
  '/node_modules',
  '/usr/local/lib/node_modules',
  '/usr/lib/node_modules' ]

Windows

// example was run from the "F:\\dev\\npm-paths" directory
[ 'C:\\Users\\SERVER\\AppData\\Roaming\\node_modules\\npm',
  'C:\\Program Files\\nodejs\\node_modules',
  'F:\\dev\\npm-paths\\node_modules',
  'F:\\dev\\node_modules',
  'F:\\node_modules' ]

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Running Tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test
Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

You might also be interested in these projects:

  • global-modules: The directory used by npm for globally installed npm modules. | homepage
  • global-paths: Returns an array of unique "global" directories based on the user's platform and environment. The… more | [homepage](https://github.com/jonschlinkert/global-paths "Returns an array of unique "global" directories based on the user's platform and environment. The resulting paths can be used for doing lookups for generators or other globally installed npm packages. Node.js / JavaScript.")
  • global-prefix: Get the npm global path prefix. | homepage

Contributors

CommitsContributor
13jonschlinkert
2loremaps
1doowb

Author

Jon Schlinkert

License

Copyright © 2018, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.8.0, on December 15, 2018.

Keywords

FAQs

Last updated on 15 Dec 2018

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