Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

require('vscode') throw error #51

Open
linguiqi opened this issue Oct 9, 2021 · 1 comment
Open

require('vscode') throw error #51

linguiqi opened this issue Oct 9, 2021 · 1 comment

Comments

@linguiqi
Copy link

linguiqi commented Oct 9, 2021

there is a line of code in the _require function
const filename = Module._resolveFilename(id, this)
It seems to want to find the entry file of the require module. however, 'vscode' doesn't have a such file. as the result, _resolveFilename will throw error "cannot find module 'vscode' ".
Now I can only call "require('vscode')" before hook. I think it is not a good solution. Will this be fixed?

@trentm
Copy link
Contributor

trentm commented Jan 12, 2023

@linguiqi Is this still relevant? Sorry this has been over a year. I see that the https://www.npmjs.com/package/vscode package has been deprecated. If I install the latest version and require('vscode') I see:

> require('vscode')
Uncaught Error: Cannot find module 'vscode'
Require stack:
- <repl>
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
    at Function.Module._load (node:internal/modules/cjs/loader:833:27)
    at Module.require (node:internal/modules/cjs/loader:1057:19)
    at require (node:internal/modules/cjs/helpers:103:18) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '<repl>' ]
}
>

so I'm not sure where to start.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants