TypeScript error TS1005: ';' expected (II)

Solution 1:

Your installation is wrong; you are using a very old compiler version (1.0.3.0).

tsc --version should return a version of 2.5.2.

Check where that old compiler is located using: which tsc (or where tsc) and remove it.

Try uninstalling the "global" typescript

npm uninstall -g typescript

Installing as part of a local dev dependency of your project

npm install typescript --save-dev

Execute it from the root of your project

./node_modules/.bin/tsc

Solution 2:

On Windows you can have in your PATH

PATH = ...;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\; ...

remove it from PATH env, then

npm install -g typescript@latest

it worked for me to solve the

"TypeScript error TS1005: ';' expected"

See also how to update TypeScript to latest version with npm?

Solution 3:

You don't have the last version of typescript.

Running :

npm install -g typescript

npm checks if tsc command is already installed.

And it might be, by another software like Visual Studio. If so, npm doesn't override it. So you have to remove the previous deprecated tsc installed command.

Run where tsc to know its bin location. It should be in C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\ in windows. Once found, delete the folder, and re-run npm install -g typescript. This should now install the last version of typescript.

Solution 4:

I faced the same error. After banging my head for half an hour, I found one Romeo bracket hanging around without his Juliet LOL...!(the opening and closing brackets were mismatching) Please check all your brackets to avoid such errors.