forked from npm/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
windows: search for a user-installed npm
This changes npm.cmd and the npm script when running in Cygwin to look for an npm installation in prefix, running it if found. The default npm is used to get the prefix. This implements the changes described in nodejs/node-v0.x-archive#8528 . Fixes nodejs/node-v0.x-archive#8528. Reference: nodejs/node-v0.x-archive#8554. Fixes: npm#6412 PR-URL: npm/npm#9089
- Loading branch information
1 parent
599240f
commit 89320ba
Showing
2 changed files
with
34 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
:: Created by npm, please don't edit manually. | ||
@IF EXIST "%~dp0\node.exe" ( | ||
"%~dp0\node.exe" "%~dp0\.\node_modules\npm\bin\npm-cli.js" %* | ||
) ELSE ( | ||
node "%~dp0\.\node_modules\npm\bin\npm-cli.js" %* | ||
@ECHO OFF | ||
|
||
SETLOCAL | ||
|
||
SET "NODE_EXE=%~dp0\node.exe" | ||
IF NOT EXIST "%NODE_EXE%" ( | ||
SET "NODE_EXE=node" | ||
) | ||
|
||
SET "NPM_CLI_JS=%~dp0\node_modules\npm\bin\npm-cli.js" | ||
FOR /F "delims=" %%F IN ('CALL "%NODE_EXE%" "%NPM_CLI_JS%" prefix -g') DO ( | ||
SET "NPM_PREFIX_NPM_CLI_JS=%%F\node_modules\npm\bin\npm-cli.js" | ||
) | ||
IF EXIST "%NPM_PREFIX_NPM_CLI_JS%" ( | ||
SET "NPM_CLI_JS=%NPM_PREFIX_NPM_CLI_JS%" | ||
) | ||
|
||
"%NODE_EXE%" "%NPM_CLI_JS%" %* |