TypeScript-Sublime-Plugin: ERROR: can not send request; node process not running

I installed TypeScript for Sublime for the first time and it worked like a charm. All of a sudden I am getting errors about node not running.

Excerpt from console:

spawning node module: C:\Users\psycketom\Desktop\ST3\Data\Packages\TypeScript\tsserver\tsserver.js
Found node executable at node
2015-06-15 16:48:25,048: 12592: ERROR: can not send request; node process not running

I just edited my preferences, to point to the exact node path. No success either:

spawning node module: C:\Users\psycketom\Desktop\ST3\Data\Packages\TypeScript\tsserver\tsserver.js
Found node executable at C:\Program Files\nodejs\node.exe
2015-06-15 16:58:35,129: 12448: ERROR: can not send request; node process not running

After numerous ST restarts, I found out that the problem is occasional.

And environment info: Windows 7 x64 node v0.12.3 Sublime Text 3, build 3083


What could be the problem?

About this issue

  • Original URL
  • State: open
  • Created 9 years ago
  • Comments: 48 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Just to try the static approach, does something like this work for you @igl ?

File: ~/Library/Application Support/Sublime Text 3/Packages/User/Preferences.sublime-settings

{
    "node_path": "/usr/local/var/nvm/versions/node/v5.1.0/bin/node"
}

( and possibly other properties, but the one mentioned is the most important one )

$NVM_BIN might not be resolved in OSX because GUI applications are not “sourced” with ~/.bash_profile thus the corresponding env vars are not set. This behaviour is encountered when applications are started from Dock/Spotlight.

PS: More info & links: http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x

Much appreciated @zhengbli. For other people with the same problem, I’ve figured out a work-around that ended up to be quite easy:

I’ve specified the following path in my PROJECTNAME.sublime-project file:

"node_path": "${NVM_BIN}/node"

For completeness the other steps I’ve taken (I’m on OSX):

I’ve added the following lines to my ~/.bashrc

export NVM_DIR=$(brew --prefix)/var/nvm
source $(brew --prefix nvm)/nvm.sh
PATH="${PATH}:${NVM_BIN}"

And I’ve applied the patch by @mcnameej.

I’m not sure if all steps are required for it to work properly, but now I have the completion and features that I was looking for.

The real issue here is that Python doesn’t implicitly perform variable expansion. Quick demonstration:

>>> os.path.isfile('$NVM_BIN/node')
False
>>> os.path.isfile(os.path.expandvars('$NVM_BIN/node'))
True

At least it’s an easy fix.