Closed
Description
You can read the original issues description in vscode-tslint #173.
Whenever I try to set a nodePath
for vscode-tslint, it always ends up using the global node_modules path.
You can see that even though the NODE_PATH has a value, it still continues on to call resolveGlobalNodePath
.
[Trace - 10:24:16 AM] NODE_PATH value is: c:\Projects\CloudTestGrading\node_modules\@remark\typescript\node_modules
[Trace - 10:24:17 AM] 'npm config get prefix' value is: C:\Program Files\nodejs
[Trace - 10:24:17 AM] NODE_PATH value is: C:\Program Files\nodejs\node_modules
From server/src/files.ts
:
export function resolveModulePath(workspaceRoot: string, moduleName: string, nodePath: string, tracer: (message: string, verbose?: string) => void): Thenable<string> {
if (nodePath) {
if (!path.isAbsolute(nodePath)) {
nodePath = path.join(workspaceRoot, nodePath);
}
return resolve(moduleName, nodePath, nodePath, tracer).then((value) => {
// This line seems to be the culprit
if (value.indexOf(path.normalize(nodePath)) === 0) {
return value;
} else {
return Promise.reject<string>(new Error(`Failed to load ${moduleName} from node path location.`));
}
}).then(undefined, (_error: any) => {
// We are passing a custom nodePath that _should_ be valid,
// so we do not expect this to be called.
return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);
});
} else {
return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);
}
}
Metadata
Metadata
Assignees
Labels
No labels