Vscode: error TS2307: Cannot find module 'vscode'

前端 未结 4 1518
深忆病人
深忆病人 2021-02-19 10:57

When compiling VSCode extension then typescript persistently complained

error TS2307: Cannot find module \'vscode\'.

Installation <

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-19 11:26

    The solution

    Run npm install will fix the issue.

    Why?

    Because there is "post install" script (node ./node_modules/vscode/bin/install) which fetch a vscode.d.ts according to the engine you're using in your project.

    Detected VS Code engine version: ^1.6.0 Found minimal version that qualifies engine range: 1.6.0 Fetching vscode.d.ts from: https://raw.githubusercontent.com/Microsoft/vscode/e52fb0bc87e6f5c8f144e172639891d8d8c9aa55/src/vs/vscode.d.ts vscode.d.ts successfully installed!

    source

提交回复
热议问题