10basetom

nodevars.bat

Apr 5th, 2016
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.78 KB | None | 0 0
  1. @echo off
  2.  
  3. :: Ensure this Node.js and npm are first in the PATH
  4. set PATH=%CD%;%PATH%
  5. set NODE_PATH=%CD%\npm\node_modules
  6.  
  7. :: This is required below
  8. setlocal enabledelayedexpansion
  9.  
  10. :: Figure out the Node.js version
  11. set print_version=.\node.exe -p -e "process.versions.node + ' (' + process.arch + ')'"
  12. for /F "usebackq delims=" %%v in (`%print_version%`) do set version=%%v
  13.  
  14. :: Print message
  15. if exist npm.cmd (
  16.   echo Your environment has been set up for using Node.js !version! and npm.
  17. ) else (
  18.   echo Your environment has been set up for using Node.js !version!.
  19. )
  20.  
  21. :: Set the location of globally installed npm modules
  22. npm config set prefix "/dev/nodejs/npm" -g
  23.  
  24. :: Required for 'npm install' to work correctly in Windows
  25. npm config set python /dev/python/python.exe --global
Advertisement
Add Comment
Please, Sign In to add comment