The npm binary script on windows ends up invoking the npm-cli.js file under node.exe and passing along the command line arguments. So that's what I am doing.

%APPDATA%/npm is the home to the npm packages, not the binary script. So I think the old code was wrong there.

From: pinnamur <notifications@github.com<mailto:notifications@github.com>>
Reply-To: aptana/studio3 <reply@reply.github.com<mailto:reply@reply.github.com>>
Date: Wednesday, September 25, 2013 3:46 PM
To: aptana/studio3 <studio3@noreply.github.com<mailto:studio3@noreply.github.com>>
Cc: Christopher Williams <cwilliams@appcelerator.com<mailto:cwilliams@appcelerator.com>>
Subject: Re: [studio3] TISTUD-5417 Inconsistent PATH lookup for Node and other components (#120)


In plugins/com.aptana.js.core/src/com/aptana/js/internal/core/node/NodePackageManager.java:

> +     private final IPath npmPath;
> +
> +     public NodePackageManager(INodeJS nodeJS)
> +     {
> +             this.nodeJS = nodeJS;
> +
> +             // TODO Is there any way a user can install NPM in non-standard location relative to node?
> +
> +             // Windows "npm" script is a sh script that tries to execute $basedir/node_modules/npm/bin/npm-cli.js under
> +             // "$basedir/node.exe" if it exists.
> +             // So for Windows, it would appear we'd need to run:
> +             // /path/to/node.exe /path/to/node/node_modules/npm/bin/npm-cli.js <args>
> +             if (PlatformUtil.isWindows())
> +             {
> +                     npmPath = nodeJS.getPath().removeLastSegments(1).append(NODE_MODULES).append(NPM).append(BIN)
> +                                     .append("npm-cli.js"); //$NON-NLS-1$


I don't remember npm-cli.js script has to be run in order to execute npm command. %APPDATA%\npm is the one we are running for executing npm commands.

-
Reply to this email directly or view it on GitHub<https://github.com/aptana/studio3/pull/120/files#r6583472>.