Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DAEMON-121] Fix lookup of npm in 32bit Node #130

Merged
merged 1 commit into from Nov 10, 2017
Merged

[DAEMON-121] Fix lookup of npm in 32bit Node #130

merged 1 commit into from Nov 10, 2017

Conversation

ewanharris
Copy link
Contributor

https://jira.appcelerator.org/browse/DAEMON-121

This fixes the lookup of npm so that we can find it under a 32 bit Node install on 64 bit Windows.

It also changes the lookup slightly so it is now as follows

  • Run npm get prefix
  • Look for $prefix/node_modules/npm/package.json, if it's a file continue on
    • If it's not a file, look in either %ProgramFiles%/nodejs/node_modules/npm/package.json or /usr/local/node_modules/npm/package.json, if it's a file continue on
      • If it's not a file, look in either %ProgramFiles(x86)%/nodejs/node_modules/npm/package.json or /usr/local/lib/node_modules/npm/package.json

This means that we always prefer the globally installed npm on Windows, (which seems correct to me), one caveat is that the path property of npm points us to the one under node, but that's not a major deal as the npm.cmd file will forward us on to the global npm. We might wish to fix that for correctness 🤷‍♂️


try {
npm = await which(`npm${cmd}`);
const { stdout } = run(npm, 'prefix', '-g');
const { stdout } = await run(npm, [ 'prefix', '-g' ]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did this ever work?

Copy link
Contributor

@cb1kenobi cb1kenobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cb1kenobi cb1kenobi merged commit a7897a9 into tidev:master Nov 10, 2017
@ewanharris ewanharris deleted the DAEMON-121 branch November 30, 2017 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants