10basetom

npm.cmd

Apr 6th, 2016
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.40 KB | None | 0 0
  1. @echo off
  2.  
  3. setlocal
  4.  
  5. set "NODE_EXE=%~dp0\node.exe"
  6. if not exist "%NODE_EXE%" (
  7.   set "NODE_EXE=node"
  8. )
  9.  
  10. set "NPM_CLI_JS=%~dp0\npm\bin\npm-cli.js"
  11. for /F "delims=" %%F in ('call "%NODE_EXE%" "%NPM_CLI_JS%" prefix -g') do (
  12.   set "NPM_PREFIX_NPM_CLI_JS=%%F\npm\bin\npm-cli.js"
  13. )
  14. if exist "%NPM_PREFIX_NPM_CLI_JS%" (
  15.   set "NPM_CLI_JS=%NPM_PREFIX_NPM_CLI_JS%"
  16. )
  17.  
  18. "%NODE_EXE%" "%NPM_CLI_JS%" %*
Advertisement
Add Comment
Please, Sign In to add comment