https://github.com/dracupid/global-npm
Require global npm as a local node module.
https://github.com/dracupid/global-npm
finder npm
Last synced: 3 months ago
JSON representation
Require global npm as a local node module.
- Host: GitHub
- URL: https://github.com/dracupid/global-npm
- Owner: dracupid
- License: mit
- Created: 2015-05-16T16:10:42.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-03-31T08:11:54.000Z (over 3 years ago)
- Last Synced: 2025-06-28T19:14:12.245Z (3 months ago)
- Topics: finder, npm
- Language: JavaScript
- Size: 15.6 KB
- Stars: 32
- Watchers: 2
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
global-npm
======
Require global npm as a local node module.[](https://www.npmjs.com/package/global-npm)
[](https://david-dm.org/dracupid/global-npm)
[](https://travis-ci.org/dracupid/global-npm)
[](https://ci.appveyor.com/project/dracupid/global-npm)[](https://github.com/feross/standard)
Npm is about 25MB in size now, which is quite a heavy dependency for most modules. Luckily, nearly every node.js user has a npm installed globally.
However, normally, you can't require a global module directly, unless:
0. [set `NODE_PATH` environment variable](https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders) to the folder where global modules are installed.
0. [link](https://docs.npmjs.com/cli/link) the local project with global module to use.
0. [require a file path](https://nodejs.org/api/modules.html#modules_file_modules) instead of a module name.The last one should be the best way for a third-party module.
If your module needs to depend on `npm`, why not just use the global one?
## Usage
```javascript
var npm = require('global-npm')
```**If the version of npm counts, please use [semver](https://github.com/npm/node-semver) to check `npm.version` by yourself.**
## License
MIT@Dracupid