Home > Software engineering >  Cannot find module 'vscode' - Missing VSCode engine declaration in package.json
Cannot find module 'vscode' - Missing VSCode engine declaration in package.json

Time:01-27

I'm developing a VSCode extension (package.json) and I get the "Error: Cannot find module 'vscode'" whenever I run it.

I've already tried running

npm install

and it did not help. When I run

node ./node_modules/vscode/bin/install

I get "Error installing vscode.d.ts: Missing VSCode engine declaration in package.json.".

CodePudding user response:

Remove the "vscode" dev dependency. No idea what that is for.

CodePudding user response:

Your package.json is out of date, and is still using a deprecated definition. This has been changed, if I remember correctly, a couple of years ago.

You should update your dependency to something like

 "devDependencies": {
    "@types/vscode": "^1.73.0"
    ...
  }

And don't forget to update the engines entry as well, to reflect the minimun VS Code version your extension will support.

    "engines": {
        "vscode": "^1.73.0"
    },

Hope this helps

  • Related