Reputation: 3659
I just installed vs code v1 (the latest version) and typescript v1.8.10 (latest version). I followed the exact instruction from vs code website but can't get vs code to build the simplest typescript file though I can manually build it by running tsc command in git bash. The output from the vs code is:
error TS5007: Cannot resolve referenced file: '.'.
error TS5023: Unknown option 'p'
Use the '--help' flag to see options.
This is the my helloworld.ts file which really can't be simpler:
class Greet {
private _message : string;
constructor(message : string) {
this._message = message;
}
Say = () => console.log(this._message);
}
var g = new Greet('hello typescript!');
g.Say();
This is my tasks.json file:
{
// See http://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"args": ["-p", "."],
"showOutput": "silent",
"problemMatcher": "$tsc"
}
and tsconfig.json:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"sourceMap": true
}
}
Upvotes: 14
Views: 6394
Reputation: 104
I resolve this problem by simply delete all older version of typescript. In my case i move to installed location of typescript like
C:\Program Files (x86)\Microsoft SDKs\TypeScript , this is the location where all typescript version installed. after deleting file and reopen visual studio code and it works fine!
Upvotes: 0
Reputation: 711
Maybe it can help as mentioned at (VS Code, error, TS5023) Unknown compiler option 'p'
Open your environment settings and remove the old Typescript from your system PATH variable. Mine was C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\
.
Path
variable and click Edit
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\
in the text, delete it. Press "OK" three times.Upvotes: 26
Reputation: 375
I got this error in vs code. Box [Windows 08, VS Code]
error TS5007: Cannot resolve referenced file: '.'.
error TS5023: Unknown option 'p'
Use the '--help' flag to see options.
Solution
C:\Program Files (x86)\Microsoft SDKs\TypeScript
1.0
. If you don't have 1.8
version then install new typescript version from official download page. I installed Visual Studio 2013Then it worked.
Note: - this answer suggests to do same thing. I am writing this answer to explicitly show all the steps. Also, I think community discourages, while answering, to just link the article, since link can go dead.
Upvotes: 8