4

I'm developing a VSCode extension to automate some edit & search processes. Everything runs Ok! in the Extension Development Host but when I try to package the extension with vsce inside the extension's folder the app responds with this error:

 ERROR  Extension entrypoint(s) missing. Make sure these files exist and aren't ignored by '.vscodeignore':
  extension/extension.js

At the extension's manifest(package.json) the entrypoint to the extension code is defined in the "main" key:

...
"activationEvents": [
        "onCommand:extension.findBlock"
],
"main": "./extension.js",
"contributes": {
    "commands": [
        {
        "command": "extension.findBlock",
        "title": "Find Block"
        }
    ],
...

In the extension's folder everything is as the visual studio extension generator(yo) left it.

.
├── block_finder.code-workspace
├── CHANGELOG.md
├── extension.js
├── findBlock.png
├── jsconfig.json
├── node_modules
├── package.json
├── package-lock.json
├── prueba.txt
├── README.md
├── test
└── vsc-extension-quickstart.md

Am I missing something? I don't understand what could be happening. My VSCode version is 1.65.2 and vsce is 2.7.0. Thanks!

AdamRaichu
  • 149
  • 1
  • 13
BC Coder
  • 43
  • 6
  • Maybe it is getting confused by using `extension` as your command ids? Since it is looking for `extension/extension.js` for some odd reason. Try `"command": "block-finder.findBlock",` and same in `activationEvents`. – Mark Mar 31 '22 at 02:48
  • Hey @Mark, thanks for your time! I've tried your suggestions but `vsce package` keeps looking for `extension/extension.js`. I've created a folder `/extension` and put the extension code (extension.js) in it but now vsce looks for `extension/extension/extension.js` hahaha! It's my first extension, it's ready but I can't install it and use it. :( – BC Coder Mar 31 '22 at 22:43
  • I guess you could try: `"main": "extension.js",` or `"main": "../extension.js",` but they shouldn't make a difference. You may have to restart making the extension and don't use the name `extension` for anything other than your `extension.js`. – Mark Apr 01 '22 at 01:35
  • Did you fix your problem? What was the cause? – sorin Jun 25 '22 at 15:19
  • Did you find fix for this issue? – zweack Jul 06 '22 at 03:13
  • Check this answer about /dist/extension instead of /out/extension on the package.json https://stackoverflow.com/a/64788012/1461862 – Mauricio Gracia Gutierrez Oct 24 '22 at 19:26

2 Answers2

0

I spent a week trying to solve this. And it turns out the solution is quite simple. Uninstall Node.js and npm from the operating system. Install the latest version of Node.js, which I am currently using:

node -v

v20.3.1

npm -v

9.7.2

And that immediately resolved my issue. If it reoccurs, it might be worth considering using an even newer version.

-1

I came back to say that I solved the problem by uninstalling the npm manager. The version I had installed was old and I noticed that in the installation of the extension requirements it installed packages with warnings of deprecated versions. I uninstalled npm and did a clean install and my extension started working as expected. Sorry for leaving this post open and thanks for all the help you have given me.

BC Coder
  • 43
  • 6