I have globally installed two npm packages "download" and "enigmavirtualbox" via command line:
npm install -g download
and npm install -g engimavirtualbox
I'm trying to use them in a batch file to bundle a single .exe file from my node project. For both, the commands npm list -g <packagename>
yield the respective version output, independent of the present working directory.
However, inside my batch script the commands "download" and "enigmavirtualbox" cannot be found.
Running npm root -g
yields C:\Users\<username>\AppData\Roaming\npm\node_modules
and looking inside that folder I can see that folders for both packages are present.
What I have tried:
npm root
as described here C:\Users\<username>\AppData\Roaming\npm\node_modules
C:\Users\<username>\AppData\Roaming\npm\node_modules
to PATH env. variableThe same setup works on my second computer (both run Win7 64bit). Is something wrong with my node installation, or what am I doing wrong?
On Windows, you may face the “npm command not found” error if the path to nodejs and npm are not added to your path variable. To fix this, locate the path to nodejs and npm binaries. The command above should add the specified directory to the path variable.
To check for all globally installed packages and its dependencies, run the npm list command followed by the -g flag. This above command prints the all globally installed packages in tree view. You can also check if a specific package is installed globally or not using the npm list -g followed by package name.
Path of Global Packages in the system: Global modules are installed in the standard system in root location in system directory /usr/local/lib/node_modules project directory. Command to print the location on your system where all the global modules are installed.
The executable binaries and .cmd files end up in C:\Users\<username>\AppData\Roaming\npm
(minus the node_modules
at the end) so adding that path to the PATH env. variable fixed the issue.
With environment variables, the path can be abbreviated: %appdata\npm
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With