Skip to content

Commit

Permalink
fix: use default NVM directory if NVM_DIR is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
connor4312 committed Nov 2, 2021
1 parent d241749 commit 251c216
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,7 @@ This changelog records changes to stable releases since 1.50.2. "TBA" changes he

## Nightly Only

- fix: use default NVM directory if NVM_DIR is not set ([ref](https://github.com/microsoft/vscode/issues/133521))
- fix: lines offset when debugging web worker extensions ([ref](https://github.com/microsoft/vscode/issues/136242))

## v1.62 (October 2021)
Expand Down
21 changes: 12 additions & 9 deletions src/targets/node/nvmResolver.ts
Expand Up @@ -2,15 +2,15 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/

import * as path from 'path';
import * as fs from 'fs';
import { nvmHomeNotFound, nvmNotFound, nvmVersionNotFound, nvsNotFound } from '../../dap/errors';
import { ProtocolError } from '../../dap/protocolError';
import { promises as fsPromises } from 'fs';
import { inject, injectable } from 'inversify';
import * as os from 'os';
import * as path from 'path';
import { IFsUtils, LocalFsUtils } from '../../common/fsUtils';
import { some } from '../../common/promiseUtil';
import { LocalFsUtils } from '../../common/fsUtils';
import { promises as fsPromises } from 'fs';
import { IFsUtils } from '../../common/fsUtils';
import { nvmHomeNotFound, nvmNotFound, nvmVersionNotFound, nvsNotFound } from '../../dap/errors';
import { ProtocolError } from '../../dap/protocolError';

/**
* Resolves the location of Node installation querying an nvm installation.
Expand Down Expand Up @@ -77,9 +77,12 @@ export class NvmResolver implements INvmResolver {
directory = await this.resolveWindowsNvm(version);
versionManagers.push('nvm-windows');
}
} else if (this.env[Vars.UnixNvmHome]) {
directory = await this.resolveUnixNvm(version);
versionManagers.push('nvm');
} else {
const nvmDir = this.env[Vars.UnixNvmHome] || path.join(os.homedir(), '.nvm');
if (await this.fsUtils.exists(nvmDir)) {
directory = await this.resolveUnixNvm(version);
versionManagers.push('nvm');
}
}
}

Expand Down

0 comments on commit 251c216

Please sign in to comment.