javascript-typescript-langserver
javascript-typescript-langserver copied to clipboard
Error importing modules from node_modules, even though tsc runs fine.
I have a project that has no errors when running tsc
on it, but will show errors when opening it in VSCode with the javascript-typescript-langserver extensions.
The problem occurs because of a peculiar directory structure, which is this:
- node_modules
- events
- src
- tsconfig.json
- index.ts //contains `import { EventEmitter } from "events"`, which has an error.
- package.json
Also note that in VSCode I open the folder 'src', so that the root of the LSP server will be ./src, not ./
If I run tsc
from the ./src directory, it runs fine without errors, but in VSCode, any imports from node_modules will error with 'Could not find module
To reproduce:
- Clone https://github.com/keyboardDrummer/repro-ts-server-sourcegraph-issue
- Install the javascript-typescript-langserver extension in VSCode
- Open the src directory in VSCode
- Open the index.ts file
- Note the incorrect error on the import
Is there no one maintaining this project?
I am seeing this as well -- did you make any progress?
This issue is resolved by this PR. However I would recommend using the TypeFox LSP server since it's made for IDE usage and has a much simpler architecture.
Same issue, more than one year and a half later. I’ve followed your advice, and switched to server from Theia IDE.