Version mismatch between tsc compiler and VS code encoding service

I just started playing with Visual Studio Code, and when I created a new index.html file, I will show this warning message

The version mismatch between the globally installed tsc compiler (1.0.3.0) and the VS code coding service (1.8.10) has

Could someone please call me what should I do to fix this.

Whether this is serious or I can ignore. I googled but could not get much information

thank

enter image description here

+42
visual-studio-code
Sep 15 '16 at 7:13
source share
12 answers

I added this to my settings.json file, accessed via preferences > Workspace Settings :

"typescript.tsdk": "node_modules/typescript/lib"

now I no longer get this error, and the current version of Typescript that I installed is displayed in the lower right corner of the screen.

+28
Sep 24 '16 at 5:41
source share

[UPDATE] VS Code 1.6 now ships with TypeScript 2.0.3 .

I just installed the latest Typescript, currently v.2.0.3 , and installed VS v.1.5.3 code on macOS Sierra. For some reason, it was after an official document that didn't work for me.

Here is how I did it:

After installing the latest version worldwide: npm i -g typescript , I added the following line to my settings.json file ( cmd + , open):

"typescript.tsdk": "/usr/local/lib/node_modules/typescript/lib",

Hope this helps someone else.

[update] like @ptpaterson mentioned in the comment below on windows path: "typescript.tsdk": "C:/Users/{user_name}/AppData/Roaming/npm/node_modules/typescript/lib/"

+17
Sep 23 '16 at 18:30
source share

After that, you need to update and install the Typescript recovery code:

 npm install -g typescript 

or

 npm install -g typescript@1.8.10 

The message should not appear anymore if it worked.

+10
Sep 15 '16 at
source share

You must change the TypeScript version that Visual Code uses to match the installed version:

https://code.visualstudio.com/docs/languages/typescript#_using-newer-typescript-versions

The above is taken from the link:

If you want to use a newer version of TypeScript, you can define the typescript.tsdk parameter (File> Settings> User / Operational Parameters), pointing to the directory containing the TypeScript file tsserver.js.

You can find the installation location using the npm TypeScript list, tsserver.js is usually located under the lib folder.

For example:

 { "typescript.tsdk": "node_modules/typescript/lib" } 
+10
Sep 23 '16 at 12:08
source share

This error is generated because I had a link to an older TypeScript installation in my System Path variable:

 C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\ 

Visual Studio Code Error was fixed when I deleted this entry.

However, my TypeScript files then failed to overlap because the build action could not find the tsc.exe file.

When the SDK is installed (via Visual Studio or using the *.visx manual installation), the tsc.exe file is tsc.exe , and the PATH environment variable is updated to refer to the folder in which this file is located (see above).

There is another way to move your files in a Windows environment using node.js:

  • Install node.js. Installation packages can be found here .
  • Use npm to install TypeScript:

    npm install -g typescript

    This will add TypeScript files to your AppData folder:

    C:\Users\{your_user_name}\AppData\Roaming\npm\node_modules\typescript\lib

  • Customize the Visual Studio Code file of the user settings.json to link to this folder:

     {
     "typescript.tsdk": "C: \\ Users \\ {your_user_name} \\ AppData \\ Roaming \\ npm \\ node_modules \\ typescript \\ lib"
     } 
  • Add / update the PATH user environment variable to refer to the folder containing the tsc.cmd file:

    %USERPROFILE%\AppData\Roaming\npm

+8
Dec 07 '16 at 16:42 on
source share

None of the above solutions worked for me - first of all, this is global tsc, which I want to update to the latest version.

After I did some research, it turned out that the problem was with the PATH system variables; tsc.cmd (along with tscserver.cmd ) exists in the following places:

  • c: \ Program Files \ nodejs - where npm.exe and node.exe
  • % USERPROFILE% \ AppData \ Roaming \ npm - where are the global packages

What you can do is juggle the \ user environment variables, so the tsc command will be removed from % USERPROFILE% first instead of Program Files .

The quick and dirty way will simply remove tsc.cmd and tscserver.cmd from the Program Files .

+4
Mar 11 '17 at 13:30
source share

Installing v2.0.3 from typescript was insufficient ... but then updating the version dependency on package.json worked for me.

Npm Team:

 npm install -g typescript@2.0.3 

Updated line on package.json:

 "typescript": "^2.0.3" 
+3
Oct 17 '16 at 6:56
source share

Install TypeScript globally to split the installation between workspaces. In this case, you install it using npm install -g typescript@next .

Then you need to point VS Code to the setting.json file ( File -> Preferences -> Workspace Settings ) the installation location using the typescript.tsdk parameter. Install typescript.tsdk on the lib folder path containing the tsserver.js file of the installed TypeScript module.

In the windows: "typescript.tsdk": "C:/Users/<MyUser>/AppData/Roaming/npm/node_modules/typescript/lib"

On Mac: "typescript.tsdk": "/usr/local/lib/node_modules/typescript/lib"

+1
Sep 28 '16 at 15:24
source share

Installing VSCode 1.6.0 fixed the TypeScript version mismatch warning for me.

+1
Oct 12 '16 at 13:00
source share

The reason for my experience with this problem (in VSCode 1.8 on Mac OS X 10.12.2) was that I use NVM, and when my code worked in the NVM version, VSCode looked at the installation of the node system.

Double check which npm installation you use to install typescript all over the world. If in doubt (on linux / mac), use which tsc from the command line to check the location used by VSCode.

For example, if I just call npm i -g typescript , npm allowed ~/.nvm/versions/node/v6.9.1/bin/npm . I had to solve the problem by explicitly calling /usr/local/bin/npm i -g typescript , because by default VSCode searches for the node in /usr/local/bin/node .

+1
Dec 23 '16 at 15:32
source share

If you should refuse the fact, you can add this to your settings.json file using the settings:

 "typescript.check.tscVersion": false 

According to the comment in VS Code 1.10.2:

Verify that the TypeScript global installation compiler (for example, tsc) is different from the TypeScript language service you are using.

0
Mar 09 '17 at 15:56
source share

You think this is a Microsoft product that they will give the Windows paths on their website.

https://code.visualstudio.com/docs/languages/typescript#_using-newer-typescript-versions

but they do not. They give only Unix path types. Usage: - In the windows: "typescript.tsdk": "C: / Users / YourNameHere / AppData / Roaming / npm / node_modules / typescript / lib /"

Note that front strokes should be used even if Windows uses back strokes for paths!

Some other answers skip the last move forward that is needed.

0
Jun 05 '17 at 15:41
source share



All Articles