vscode-ruby-test-adapter icon indicating copy to clipboard operation
vscode-ruby-test-adapter copied to clipboard

Cannot find module out/main.js

Open svoop opened this issue 3 years ago • 2 comments

Your environment

  • vscode-ruby-test-adapter version:
  • Ruby version: 2.7.2
  • VS Code version: 1.51.0
  • Operating System: macOS 10.14.6
  • Minitest version: 5.14.2

Expected behavior

The test suite should be detected.

Actual behavior

The developer tools log the following:

abstractExtensionService.ts:717 Activating extension 'connorshea.vscode-ruby-test-adapter' failed: Cannot find module '/Users/steve/.vscode-oss/extensions/connorshea.vscode-ruby-test-adapter-0.7.1/out/main.js'

No output in the logpanel.

Maybe Relevant Details

I'm writing spec-like tests as per MiniTest::Spec. Therefore, the filesystem looks as follows:

spec/
  |
  +-- spec_helper.rb
  |
  +-- lib/

I've tried most of the settings for this extension with zero effect.

svoop avatar Nov 10 '20 09:11 svoop

I have the same problem on my archlinux, (vscode 1.51.1) with rspec.

floreal avatar Dec 04 '20 13:12 floreal

@floreal: On ArchLinux, it's likely that you're using the code package which is actually the Open Source unofficial build of VSCode (a.k.a. "Code OSS"). It's likely this issue also affects any Arch-based distributions and OSS packaging of VSCode (e.g. VSCodium).

The error you're probably getting looks like this:

[error] Error: Cannot find module '/home/trinitronx/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.9.0-universal/out/src/main.js'
Require stack:
- /usr/lib/code/out/vs/loader.js
- /usr/lib/code/out/bootstrap-amd.js
- /usr/lib/code/out/bootstrap-fork.js
- 
	at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15)
	at o._resolveFilename (node:electron/js2c/utility_init:2:3040)
	at Module._load (node:internal/modules/cjs/loader:927:27)
	at f._load (node:electron/js2c/asar_bundle:2:13330)
	at c._load (/usr/lib/code/out/vs/workbench/api/node/extensionHostProcess.js:135:5630)
	at m._load (/usr/lib/code/out/vs/workbench/api/node/extensionHostProcess.js:132:29116)
	at D._load (/usr/lib/code/out/vs/workbench/api/node/extensionHostProcess.js:99:19764)
	at Module.require (node:internal/modules/cjs/loader:1148:19)
	at require (node:internal/modules/cjs/helpers:110:18)
	at Function.i [as __$__nodeRequire] (/usr/lib/code/out/vs/loader.js:5:98)
	at n.rb (/usr/lib/code/out/vs/workbench/api/node/extensionHostProcess.js:132:30295)
	at async Promise.all (index 0)

The OSS versions of VSCode use OpenVSX, which for some extensions that were auto-imported seems to have broken .vsix packaging. The common symptoms of this are messages like the error above where the nodejs entrypoint script can't be found because the extension wasn't packaged correctly and actually didn't include that entrypoint script file.

The workaround is to download the .vsix file manually from either the extension's GitHub Releases (if available), or the Microsoft VisualStudio Marketplace.

@connorshea: Ideally, the extension owner should claim ownership of their extension on OpenVSX and publish a working version. See #126 for more details.

trinitronx avatar Oct 06 '23 22:10 trinitronx