Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 321 Vote(s) - 3.46 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Where does npm install packages?

#1
Can someone tell me where can I find the Node.js modules, which I installed using **`npm`**?
Reply

#2
In earlier versions of NPM modules were always placed in /usr/local/lib/node or wherever you specified the npm root within the .npmrc file. However, in NPM 1.0+ modules are installed in two places. You can have modules installed local to your application in <current_app>/.node_modules or you can have them installed globally which will use the above.

More information can be found at

[To see links please register here]

Reply

#3
The easiest way would be to do

> npm list -g

to list the package and view their installed location.

I had installed npm via chololatey, so the location is

C:\MyProgramData\chocolatey\lib\nodejs.commandline.0.10.31\tools\node_modules

C:\MyProgramData\ is chocolatey repo location.
Reply

#4
From the [docs][1]:

> In npm 1.0, there are two ways to install things:
>
> - globally —- This drops modules in `{prefix}/lib/node_modules`, and puts executable files in `{prefix}/bin`, where `{prefix}` is usually
> something like `/usr/local`. It also installs man pages in
> `{prefix}/share/man`, if they’re supplied.
>
> - locally —- This installs your package in the current working directory. Node modules go in `./node_modules`, executables go in
> `./node_modules/.bin/`, and man pages aren’t installed at all.


You can get your `{prefix}` with `npm config get prefix`. (Useful when you installed node with nvm).

[1]:

[To see links please register here]

Reply

#5
From the [docs][1]:

> Packages are dropped into the node_modules folder under the prefix.
> When installing locally, this means that you can
> require("packagename") to load its main module, or
> require("packagename/lib/path/to/sub/module") to load other modules.
>
> Global installs on Unix systems go to {prefix}/lib/node_modules.
> Global installs on Windows go to {prefix}/node_modules (that is, no
> lib folder.)
>
> Scoped packages are installed the same way, except they are grouped
> together in a sub-folder of the relevant node_modules folder with the
> name of that scope prefix by the @ symbol, e.g. npm install
> @myorg/package would place the package in
> {prefix}/node_modules/@myorg/package. See scope for more details.
>
> If you wish to require() a package, then install it locally.


You can get your `{prefix}` with `npm config get prefix`. (Useful when you installed node with nvm).

Read about [locally][2].
Read about [globally][3].

[1]:

[To see links please register here]

[2]:

[To see links please register here]

[3]:

[To see links please register here]

Reply

#6
You can find ***globally** installed modules* by the command

npm list -g

It will provide you the location where node.js modules have been installed.

C:\Users\[Username]\AppData\Roaming\npm

If you install node.js modules ***locally*** in a folder, you can type the following command to see the location.

npm list
Reply

#7
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
Reply

#8
***Windows 10***: When I ran `npm prefix -g`, I noticed that the install location was inside of the git shell's path that I used to install. Even when that location was added to the path, the command from the globally installed package would not be recognized. Fixed by:

1. running `npm config edit`
2. changing the prefix to 'C:\Users\username\AppData\Roaming\npm'
3. adding that path to the system path variable
4. reinstalling the package with -g.
Reply

#9
Btw, npm will look for node_modules in parent folders (up to very root) if can not find in local.
Reply

#10
In Ubuntu 14.04 they are installed at

`/usr/lib/node_modules`
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through