0

I have installed typescript using sudo npm install -g typescript, which seems to work because tsc -version returns Version 2.2.2. I also tried installing it locally as this stackoverflow post suggested. I believe that I have everything else installed correctly because the IDE opens other files correctly.

My OS is Ubuntu 16.0.

Error message:

java.lang.IllegalStateException: Node.js could not be found.  If it is installed to a location not on the PATH, please specify the location in the TypeScript preferences.

The tsconfig.json is below. I believe that the value of typeRoots should point to the @types location. And indeed the same directory where the .json file resides, there is a node_modules/@types directory, which I would have thought should enable typescript.

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ]
  }
}
Display name
  • 1,228
  • 1
  • 18
  • 29

1 Answers1

1

The TypeScript preferences mentioned in the error message are in the Webclipse preferences. Simply enter the path returned by which node in a shell.

Screen shot of configuration

pi3
  • 1,235
  • 13
  • 15