When compiling VSCode extension then typescript persistently complained
error TS2307: Cannot find module \'vscode\'.
Installation <
You can simply install them by yarn install
or npm install
. If you've faced with "Visual Studio Code is unable to watch for file changes in this large workspace" error in VSCode, follow the instructions in this link.
Run npm install
will fix the issue.
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
The solution is a link pointing to vscode.d.ts
from node_modules
directory.
ln -s /home/work/mymodule/node_modules/vscode.d.ts /usr/share/code/resources/app/out/vs/vscode.d.ts
Update your Package.json
"scripts"
section to be:
"compile": "tsc -watch -p ./",