Skip to content

TypeScript build task fails when path to tsconfig.json file has spaces #36588

@rulero

Description

@rulero
  • VSCode Version: Code 1.17.2 (b813d12, 2017-10-16T13:59:46.104Z)
  • OS Version: Windows_NT x64 10.0.15063
  • Extensions: none

Steps to Reproduce:

  1. Create a new folder with an space somewhere in the full path, lets say "D:\Temp\Space here"
  2. Add a dummy.ts file, it could be empty
  3. Add a tsconfig.json file, it could be just a pair of curly braces:
    { }
  4. Press Ctrl+Shift+P and type/select "Task: Configure Default Build Task" then select "tsc: build - tsconfig.json", the following "taks.json" is generated:
	{
			// See https://go.microsoft.com/fwlink/?LinkId=733558
			// for the documentation about the tasks.json format
			"version": "2.0.0",
			"tasks": [
					{
							"type": "typescript",
							"tsconfig": "tsconfig.json",
							"problemMatcher": [
									"$tsc"
							],
							"group": {
									"kind": "build",
									"isDefault": true
							}
					}
			]
	}
  1. Execute the build command with Ctrl+Shift+B shortcut
    The following error message is displayed:
	> Executing task: tsc -p "d:\Temp\Space here\tsconfig.json" <

	error TS5042: Option 'project' cannot be mixed with source files on a command line.
	The terminal process terminated with exit code: 1
	
	Terminal will be reused by tasks, press any key to close it.
  1. Now close VS
  2. Rename the folder to remove the white space
  3. Execute the build command from VS again, now it works:
	> Executing task: tsc -p "d:\Temp\Space_NOT_here\tsconfig.json" <

	Terminal will be reused by tasks, press any key to close it.

Additional information:
Although the displayed command looks fine and will actually work if you Copy&Paste it into a Terminal window: tsc -p "d:\Temp\Space here\tsconfig.json"
the error message is consistent with what you'd get if you remove the quotes, which suggests they weren't there when the command was actually executed as a task by VS

EDIT: fix markdown issue

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugtasksTask system issuesverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions