I have downloaded Windows Binary (.exe) of nodejs from the main page.
How can I install and use npm
(Node package manager)?
I have downloaded Windows Binary (.exe) of nodejs from the main page.
How can I install and use npm
(Node package manager)?
Here is a guide by @CTS_AE on how to use NPM with standalone node.exe: https://stackoverflow.com/a/31148216/228508
The current windows installer from nodejs.org as of v0.6.11 (2012-02-20) will install NPM along with NodeJS.
NOTES:
%USERPROFILE%\AppData\Roaming\npm
%USERPROFILE%\AppData\Roaming\npm-cache
npm install
as that user. Some modules/utilities should be installed globally....\npm
directory to your users path yourself.To change the "global" location for all users to a more appropriate shared global location
%ALLUSERSPROFILE%\(npm|npm-cache)
(do this as an administrator):[NODE_INSTALL_PATH]\etc\
directorynpm config --global ...
actionsC:\ProgramData\npm-cache
- npm modules will go hereC:\ProgramData\npm
- binary scripts for globally installed modules will go hereC:\ProgramData\npm\node_modules
- globally installed modules will go herenpm config --global set prefix "C:\ProgramData\npm"
npm config --global set cache "C:\ProgramData\npm-cache"
C:\ProgramData\npm
to your System's Path environment variableIf you want to change your user's "global" location to
%LOCALAPPDATA%\(npm|npm-cache)
path instead:C:\Users\YOURNAME\AppData\Local\npm-cache
- npm modules will go hereC:\Users\YOURNAME\AppData\Local\npm
- binary scripts for installed modules will go hereC:\Users\YOURNAME\AppData\Local\npm\node_modules
- globally installed modules will go herenpm config set prefix "C:\Users\YOURNAME\AppData\Local\npm"
npm config set cache "C:\Users\YOURNAME\AppData\Local\npm-cache"
PATH
.setx PATH "%PATH%;C:\Users\YOURNAME\AppData\Local\npm"
For beginners, some of the npm modules I've made the most use of are as follows.
axios - for more complex http posts/getsMore advanced JS options...
For testing, I reach for the following tools...
mocha - testing frameworkchai - assertion library, I like chai.expectsinon - spies and stubs and shimssinon-chai - extend chai with sinon's assertion toolsbabel-istanbul - coverage reportsWeb tooling.
If you build it...
scripts
directory that's referenced inpackage.json
scripts via npm. You can use gulp tools inside plain scripts.Use a Windows Package manager like chocolatey. First install chocolatey as indicated on it's homepage. That should be a breeze
Then, to install Node JS (Install), run the following command from the command line or from PowerShell:
C:> cinst nodejs.install
I just installed Node.js for the first time and it includes NPM, which can be ran from the Windows cmd. However, make sure that you run it as an administrator. Right click on cmd and choose "run as administrator". This allowed me to call npm commands.
npm
can be downloaded (without installation) from here:http://nodejs.org/dist/npm/https://github.com/npm/npm/releases
I just installed latest version of node (0.6.12) in Windows 7 using msi (node-v0.6.12.msi).
npm is already shipped with it, no need to include it separately.
I was facing permission issue while running npm (npm install mysql), from the path where my nodejs resided, i.e. C:\Program Files (x86)\nodejs
Then I followed below steps:
1) Added
C:\Program Files (x86)\nodejs\npm
in environment variables - Path system variable.2) went back to only
C:\
in command prompt and gave the command -npm install mysql
- and voila! it worked..Hope this helps.