18

I'm getting this message when I go on my vscode:

The path ...\node_modules\typescript\lib doesn't point to a valid tsserver install.

I've no idea what's wrong. Any ideas?

tsconfig:

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "moduleResolution": "node",
        "sourceMap": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "declaration": true,
        "baseUrl": "./ts",
        "outDir": "js"
    },
    "exclude": [
        "node_modules",
        "js"
    ]
}
4
  • we could really use more info, like your ts config file maybe. With this much all I could tell you is to check that you have the node modules of your project installed. run an npm install in your project root folder maybe? Commented Dec 9, 2016 at 8:53
  • I've added tsconfig file content on post. Commented Dec 9, 2016 at 8:59
  • It seems like vs-code is looking for a local npm install of typescript. Commented Dec 9, 2016 at 9:01
  • Why do you suggest that? How could I change it? Commented Dec 9, 2016 at 9:03

3 Answers 3

14

Perhaps you haven't installed typescript in your project, if so - you can do this by npm install typescript --save-dev.
And accoring to Visual Studio Code documentation - please check path it's use for typescript.tsdk, maybe it should look like this:

{
   "typescript.tsdk": "./node_modules/typescript/lib"
}
Sign up to request clarification or add additional context in comments.

Comments

5

Install the version available in your package.json with the command

npm install -g typescript

Then hit ctrl+shift+p

Enter "Open user settings"

In the user settings copy the path of Typescript bin folder from node modules and assign it to "typescript.lib"

"typescript.tsdk": "D:\SampleFolder\Samplesubfolder\Sampleproject\node_modules\typescript\lib",

Note that the path should be separated by "\"

Comments

1

If you use Linux (Ubuntu, etc...), open .vscode/settings.json and change the \ char for /. Example:

Before:

"typescript.tsdk": "node_modules\\typescript\\lib",

After

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

This change fix the message at startup.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.