skip to Main Content

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.".

3

Answers


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

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
  3. I’m not sure what it is yet, and I’ll be back if I figure it out, but I’m assuming this is expecting to be run in VS Code, and I’m not doing that. I’m trying to create an LSP client outside of VS Code, and I think thats the rub.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search