InfoHeap
Tech tutorials, tips, tools and more
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Node.js tutorials

  • Install node.js on Ubuntu Linux
  • Install node.js on Mac
  • npm tutorial
  • Debug javascript using node and Chrome
  • Find source file location of a module
  • Find version of installed package
  • How to use pm2 to manage node.js application in production
  • Fix cannot find module error
 
  • Home
  • > Tutorials
  • > Web Development
  • > Node.js

node – how to find source file location of a module

on Feb 12, 2016

To find the file location for a node module require('module')._resolveFilename can be used. Here is quick code snippet and its outcome.

file = require('module')._resolveFilename('react')
console.log("react file location=" + file)

Outcome:

react file location=/usr/lib/node_modules/react/react.js

Suggested posts:

  1. node – how to fix cannot find module error
  2. How to install node.js on Ubuntu Linux
  3. Debug javascript using node-inspector, node-debug, nodemon and Chrome
  4. node – how to find version of installed package
  5. How to install node (node.js) on Mac
  6. How to find python package’s file location
  7. node-sass quick start tutorial on Linux and Mac
  8. Bash – how to get main program and current file dir location
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Node.js, Tutorials

Follow InfoHeap

facebook
twitter
googleplus
  • Browse site
  • Article Topics
  • Article archives
  • Recent Articles
  • Contact Us
  • Omoney
Popular Topics: AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries

Copyright © 2022 InfoHeap.

Powered by WordPress