'Typescript compiler API set up error: No gulpfile found

I am trying to follow the Getting set up section here (Using the Compiler API).

This results in the following error:

PS C:\Users\Volker\Desktop\ts-projects\using-the-compiler> npm install -g typescript

changed 1 package, and audited 2 packages in 2s

found 0 vulnerabilities
PS C:\Users\Volker\Desktop\ts-projects\using-the-compiler> npm link typescript
npm ERR! code 1
npm ERR! path C:\Users\Volker\AppData\Roaming\npm\node_modules\typescript
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c gulp build-eslint-rules
npm ERR! [13:58:28] No gulpfile found

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Volker\AppData\Local\npm-cache\_logs\2022-03-15T12_58_28_853Z-debug.log

My node version is v16.13.1.

What did I do wrong? How can I fix that?



Solution 1:[1]

I'm not sure what's up with those instructions (probably out of date). Just do npm install --save typescript then import it as usual:

import * as ts from "typescript";

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 David Sherret