Node js Stand Alone Portable with NPM

If you want to directly download node.exe (all distributions here) and run it by itself, including the infamous Node Package Manager NPM; here are the steps I took to accomplish this. This also applies to environments where you have restricted permissions and do not have administrative permissions. In such an instance you cannot use the installer which requires administrative permissions and would otherwise set up the PATH variable in Windows – which you cannot change anyways without admin permissions.

This all originated from the error: “npm should be run outside of the node repl, in your normal shell.”
Which I answered here at StackOverflow:
http://stackoverflow.com/questions/24476805/how-to-resolve-npm-should-be-run-outside-of-the-node-repl-in-your-normal-shell/31148216#31148216

Here’s what I did for Windows

  1. Download the node.exe stand-alone from nodejs.org
  2. Grab an NPM release zip off of github
  3. Create a folder named: node_modules in the same folder as node.exe
  4. Extract the NPM zip into the node_modules folder
  5. Rename the extracted npm folder to npm and remove any versioning ie: npm-3.3.4 –> npm.
  6. Copy npm.cmd out of the /npm/bin/ folder into the root folder with node.exe
  7. Open a command prompt in the node.exe directory (shift right-click “Open command window here”)
  8. Now you will be able to run your npm installers ie:
    • npm install -g express
    • npm install express --save

Running the installers through npm will now auto install packages where they need to be located (node_modules and the root)

Don’t forget, you will not be able to set the path variable if you do not have proper permissions. So your best route is to open a command prompt in the node.exe directory to run commands (shift right-click “Open command window here”)

This entry was posted in Interesting Finds, Web Development, Windows and tagged , , , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Leave your thoughts...

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*
*