Skip to content

Commit e023dc3

Browse files
authored
Merge pull request #16113 from Microsoft/fixNpmLocationWithSpaces
Wrap npmLocation if needed
2 parents 47bd5af + d7555ed commit e023dc3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/server/typingsInstaller/nodeTypingsInstaller.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ namespace ts.server.typingsInstaller {
8585
throttleLimit,
8686
log);
8787
this.npmPath = npmLocation !== undefined ? npmLocation : getDefaultNPMLocation(process.argv[0]);
88+
89+
// If the NPM path contains spaces and isn't wrapped in quotes, do so.
90+
if (this.npmPath.indexOf(" ") !== -1 && this.npmPath[0] !== `"`) {
91+
this.npmPath = `"${this.npmPath}"`;
92+
}
8893
if (this.log.isEnabled()) {
8994
this.log.writeLine(`Process id: ${process.pid}`);
9095
this.log.writeLine(`NPM location: ${this.npmPath} (explicit '${Arguments.NpmLocation}' ${npmLocation === undefined ? "not " : ""} provided)`);
@@ -183,4 +188,4 @@ namespace ts.server.typingsInstaller {
183188
});
184189
const installer = new NodeTypingsInstaller(globalTypingsCacheLocation, typingSafeListLocation, npmLocation, /*throttleLimit*/5, log);
185190
installer.listen();
186-
}
191+
}

0 commit comments

Comments
 (0)