Where is node modules




















Ubuntu Community Ask! Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Asked 1 year, 11 months ago. Active 6 months ago. Viewed 15k times. Improve this question. Improve this question. Lorenzo B Just so every one knows, installing without -g option will install a module to you working directory e.

Show 1 more comment. Active Oldest Votes. Global libraries You can run npm list -g to see which global libraries are installed and where they're located. When installing use -g option to install globally npm install -g pm2 - pm2 will be installed globally.

Improve this answer. Rohit Sawai 1 1 gold badge 9 9 silver badges 24 24 bronze badges. Decko Decko If you're using nvm, then your global modules may be in one of several places depending on the version of node you're using at the time. The best way is to use npm list -g as suggested in another answer. Show 6 more comments. Joe Hawkins Joe Hawkins 8, 2 2 gold badges 19 19 silver badges 28 28 bronze badges.

When I do i. This is a far more useful answer, as the output is suitable for composing larger commands without extracting path from a bunch of output.

For MacOS Mojave Add a comment. For globally-installed modules: The other answers give you platform-specific responses, but a generic one is this: When you install global module with npm install -g something , npm looks up a config variable prefix to know where to install the module. You can get that value by running npm config get prefix To display all the global modules available in that folder use npm ls -g --depth 0 depth 0 to not display their dependencies.

Noel Yap You answered my follow-up question: "Can someone tell me how I can change the location of the Node. If you are looking for the executable that npm installed, maybe because you would like to put it in your PATH, you can simply do npm bin or npm bin -g. Ken Goodridge Ken Goodridge 3, 1 1 gold badge 18 18 silver badges 22 22 bronze badges.

If you've globally installed npm packages where node was installed with homebrew and then npm updated with npm itself, you may be getting command not found errors. Nick Campbell Nick Campbell 2 2 silver badges 5 5 bronze badges. Something to note- with 1. EricSmith your link is broken too — nicolimo Example Use the module "myfirstmodule" in a Node. Report Error. Your message has been sent to W3Schools. W3Schools is optimized for learning and training.

In order to use Node. As per above syntax, specify the module name in the require function. The require function will return an object, function, property or any other JavaScript type, depending on what the specified module returns. The following example demonstrates how to use Node.

In the above example, require function returns an object because http module returns its functionality as an object, you can then use its properties and methods using dot notation e.



0コメント

  • 1000 / 1000