Closed u840903 closed 11 years ago
Thanks for the report. This looks like the same thing @CarettaCaretta reported at https://github.com/jcartledge/sublime-worksheet/issues/20#issuecomment-20284938.
I can't reproduce it here, so forgive me if I ask some obvious/stupid questions:
node -v
?which node
?Uh - not sure what else to look for at this point. We'll work this out, but I'm going to need your help.
@jcartledge definitely which('node')
returns None when _spawn
is invoked, but from terminal
> python
>>> import pexpect as pex
>>> pex.which('node')
'/usr/local/bin/node'
>>>
> node -v
v0.10.0
> which node
/usr/local/bin/node
If i remember correct i used nave, nave usemain latest
to install node.
Yesterday night it worked at some point, but today the problem is still there.
Thanks for your work, awesome plugin.
@CarettaCaretta
Because Sublime Text strip (/usr/local/bin
(at least) from PATH
environment variable/usr/local/bin
seems only accessible from terminal), so pexpect cannot find it.
You can change your worksheet.sublime-settings
accordingly, in order to get it work:
"JavaScript": {
// Here we use absolute path for node
"cmd": "/usr/local/bin/node -e \"require('repl').start('node> ')\"",
"prompt": ["node> ", "\\.\\.+ "]
}
@timonwong
i've checked, you're right and the solution works :satisfied:. Thank you.
That will work, but it would be better if you didn't have to hardcode it.
I'm not sure why, but /usr/local/bin is always in my path, no matter how I start ST - I thought maybe it made a difference if it was started from terminal rather than GUI, but not so.
I think it should be possible to append "/usr/local/bin" to os.environ["PATH"]
. I'll check it out and see if it works so people don't have to hack their config to get it working.
For me /usr/local/bin
is on the path if I start Sublime from the terminal with /Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl
, but it's not present if Sublime is started by double-clicking on the Sublime application icon.
Not sure if it's still of importance but I installed Node via Homebrew and it runs in the terminal.
> node -v
v0.10.12
> which node
/usr/local/bin/node
Happy to help!
Does anyone who has this problem want check if the path
branch resolves it? Thanks.
I've merged my attempt at a fix for this into master but it's not in a release yet. I'm not going to close until someone can verify that it solves the problem for them.
Path branch on OSX 10.8.4 and ST2.0.1 resolves the bug.
Javascript
var foo = function(bar){
return bar;
}
foo('foobar');
Javascript after eval.
var foo = function(bar){
return bar;
}
// > undefined
foo('foobar');
// > 'foobar'
Great, thanks. I'll try to wrap it up today.
In Worksheet v0.7.3 on OSX 10.8.4 and ST2.0.1 thees lines of code result in an error.
Javascript:
Console: