TypeScript inspections not running in a particular project - constantly throwing Javascript heap error
Applies to WebStorm 2017.3.3 whether TypeScript 2.6.2 or TypeScript 2.4.2 is used for the TypeScript service. Also applied to WebStorm 2017.3.1, again with either of those same two TypeScript versions. Only affects one of my projects; other projects run fine.
The console for the TypeScript service reads the following, but does not get as far as emitting a heartbeat. Instead, it hangs for a while before crashing due to a heap error and restarting.
Process: TypeScript service version: 2.6.2
Process: Default service options: {"watch":true,"sourceMap":true,"target":1,"baseUrl":"/Users/me/Sites/proj","outDir":"/Users/me/Sites/proj/built","allowJs":true,"typeRoots":["/Users/me/Sites/proj/node_modules/@types","/Users/jwork/Documents/git/types"],"module":1,"removeComments":true,"declaration":false,"noImplicitAny":true,"noImplicitThis":true,"strictNullChecks":true,"noLib":false,"configFilePath":"/Users/me/Sites/proj/tsconfig.json"}
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [/usr/local/bin/node]
2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/usr/local/bin/node]
3: v8::Utils::ReportOOMFailure(char const*, bool) [/usr/local/bin/node]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node]
5: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/local/bin/node]
6: v8::internal::Runtime_AllocateInTargetSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
7: 0x2f298220463d
8: 0x2f298237d4ac
As a result, errors in my TypeScript code do not become highlighted.
- Hector is set to inspection-level highlighting, and is not on power-save mode. All TypeScript inspections are enabled apart from TSLint.
- I have tried "invalidate caches and restart", but to no avail.
- TypeScript service is enabled, and the tsconfig.json file is present.
- Errors are detected upon webpack build, but not red-lined in the actual source (indicating probably that WebStorm's TypeScript integration is at fault rather than TypeScript itself).
- The project folder is not accessed via symlink.
The tsconfig.json is as follows:
{
"compilerOptions": {
"watch": true,
"sourceMap": true,
"target": "es5",
"baseUrl": ".",each source file!)
"outDir": "./built",
"allowJs": true,
"typeRoots": [
"node_modules/@types",
"../../Documents/git/types" // for promise-retry
],
"module": "commonjs",
"removeComments": true,
"declaration": false,
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"noLib": false
}
}
I realise, as a project-specific error, that there is probably not enough information here yet to help out; how can I further debug this? Note: the project is closed-source, so I cannot share it.
请先登录再写评论。
This is tsserver that crashes. Please see https://sandersn.github.io/manual/Workarounds-for-Out-of-Memory-Crashes.html for possible workarounds; if none of them help, please file an issue to https://github.com/Microsoft/TypeScript
Hi Elena, thank you for the resource. I tried all the suggestions, and also tried opening the same project in VS Code, but to no avail.
Whilst filing an issue under the TypeScript project, I found the problem: an MPEG-TS video stream, also with the `.ts` file extension, was being analysed by the TypeScript service by accident. I've opened an issue about it [here](https://github.com/Microsoft/TypeScript/issues/21453).
This community support issue can be considered closed now, as the issue will be tracked from now by Microsoft's TypeScript project itself.