Search code examples
visual-studio-codevscode-extensions

ENOENT: no such file or directory error in my VSCode extension


I made my first VSCode extension (an SQLite database browser/viewer), no icon yet.

enter image description here

The UI was made with html/css/javascript and I use the library 'sqlite3' as a dependency, this is my package.json:

{
  "name": "sqlite-viewer-browser",
  "displayName": "Sqlite Viewer-Browser",
  "description": "See and manage your sqlite databases easily. ",
  "version": "1.0.0",
  "publisher": "JuanGerardoMedellinIbarra",
  "repository": {
    "type": "git",
    "url": "https://github.com/thegera4/sqlite-viewer"
  },
  "engines": {
    "vscode": "^1.88.0"
  },
  "categories": [
    "Other"
  ],
  "activationEvents": [],
  "main": "./out/extension.js",
  "contributes": {
    "commands": [
      {
        "command": "sqlite-viewer.startDbViewer",
        "title": "SQLite Viewer: Start"
      }
    ]
  },
  "scripts": {
    "vscode:prepublish": "npm run compile",
    "compile": "tsc -p ./",
    "watch": "tsc -watch -p ./",
    "pretest": "npm run compile && npm run lint",
    "lint": "eslint src --ext ts",
    "test": "vscode-test"
  },
  "devDependencies": {
    "@types/mocha": "^10.0.6",
    "@types/node": "18.x",
    "@types/vscode": "^1.88.0",
    "@typescript-eslint/eslint-plugin": "^7.7.1",
    "@typescript-eslint/parser": "^7.7.1",
    "@vscode/test-cli": "^0.0.8",
    "@vscode/test-electron": "^2.3.9",
    "eslint": "^8.57.0",
    "typescript": "^5.4.5"
  },
  "dependencies": {
    "sqlite3": "^5.1.7"
  }
}

When I run/debug it locally everything works as expected.

enter image description here

Also, when I packaged it and published it to the VSCode extension marketplace, I got no errors, and everything looked ok, but when I installed it (already from the marketplace) and tried to run it, I got the next error:

enter image description here

Can someone help me with this?

I already tried to remove the extension from the marketplace, re-packaged it, and re-published it, with the same result.

Update: After inspecting the folder that gets created when you install the extension from the marketplace, I see that my "src" folder that contains the "index.html" file is not there, this is why I'm getting this "missing file" error. I still do not know why some files and folders are being deleted when I upload my ".vsix" file to the marketplace (if I install the extension locally with the ".vsix" file, it works perfectly fine)


Solution

  • Second update: My extension works for everyone, but not for me, I might have to delete my vscode and install it again, but what I am doing right now is, using it locally installed with the .vsix file.