1 # resolve-cwd [![Build Status](https://travis-ci.org/sindresorhus/resolve-cwd.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-cwd)
3 > Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from the current working directory
9 $ npm install --save resolve-cwd
16 const resolveCwd = require('resolve-cwd');
18 console.log(__dirname);
19 //=> '/Users/sindresorhus/rainbow'
21 console.log(process.cwd());
22 //=> '/Users/sindresorhus/unicorn'
25 //=> '/Users/sindresorhus/unicorn/foo.js'
31 ### resolveCwd(moduleId)
33 Like `require()`, throws when the module can't be found.
35 ### resolveCwd.silent(moduleId)
37 Returns `null` instead of throwing when the module can't be found.
43 What you would use in `require()`.
48 - [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module from a given path
49 - [req-from](https://github.com/sindresorhus/req-from) - Require a module from a given path
50 - [req-cwd](https://github.com/sindresorhus/req-cwd) - Require a module from the current working directory
51 - [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point
52 - [lazy-req](https://github.com/sindresorhus/lazy-req) - Require modules lazily
57 MIT © [Sindre Sorhus](https://sindresorhus.com)