onivim / oni

Oni: Modern Modal Editing - powered by Neovim
https://www.onivim.io
MIT License
11.34k stars 299 forks source link

NeoVim editor does not spawn on Mac OS X 10.13.3 #1583

Open MikeDacre opened 6 years ago

MikeDacre commented 6 years ago

When trying to run Oni (0.3.0) for the first time on my Mac (10.13.3), the GUI and folder list open, but the actual neovim editor does not, it just appears as a blank screen:

image

I then have to force quit it to get it to actually close.

When I look at the console, I see this error when I try to open a file to edit:

0.bundle.js:182 Uncaught (in promise) TypeError: Cannot read property 'request' of undefined
    at T.command (0.bundle.js:182)
    at ee.<anonymous> (1.bundle.js:58)
    at Generator.next (<anonymous>)
    at 1.bundle.js:58
    at Promise (<anonymous>)
    at Z (1.bundle.js:58)
    at ee.openFile (1.bundle.js:58)
    at p.<anonymous> (1.bundle.js:34)
    at Generator.next (<anonymous>)
    at 1.bundle.js:34 

The full log is here: https://pastebin.com/RzEBGK2V

Some possible issues I can think of:

Note: I also have an Arch Linux machine, and Oni just worked perfectly there with the exact same config, so that makes the first option much less likely. I also tried deleting my entire config from the ~/nvim and ~/.oni directories, so that probably eliminates the config as an issue, unless Oni is caching it somehow.

oni-bot[bot] commented 6 years ago

Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.

akinsho commented 6 years ago

@MikeDacre, sorry to hear that sometimes if theres a conflict or error with the init.vim the editor might not start can I ask what's the output of the :messages command and what version of nvim are you running locally?

MikeDacre commented 6 years ago

Hi @Akin909, unfortunately I couldn't run :messages because it would hang before I got there. I had both nvim version 0.2.2 from brew installed and also VimR. Output of :version:

NVIM v0.2.2
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -I/tmp/neovim-20180209-92407-udkzoo/neovim-0.2.2/build/config -I/tmp/neovim-20180209-92407-udkzoo/neovim-0.2.2/src -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/opt/gettext/include -I/usr/include -I/tmp/neovim-20180209-92407-udkzoo/neovim-0.2.2/build/src/nvim/auto -I/tmp/neovim-20180209-92407-udkzoo/neovim-0.2.2/build/include
Compiled by brew@HighSierra.local

Features: +acl +iconv +jemalloc +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.2.2_1/share/nvim"

Run :checkhealth for more info

I tried:

None of those helped at all. I tried looking in ~/Library/Logs/Oni and the Mac Console app, and I only found three messages there relating to Oni:

*** WARNING: Textured window <AtomNSWindow: 0x7fe51dd00890> is getting an implicitly transparent titlebar. This will break when linking against newer SDKs. Use NSWindow's -titlebarAppearsTransparent=YES instead.
GVA info: preferred scaler idx 0
LSExceptions shared instance invalidated for timeout.

None of those look too serious, so I am kinda stumped about what to do next.

akinsho commented 6 years ago

@MikeDacre can you try running oni from the command line using oni --debug this will open the developer tools and we should be able to see whatever error is crashing oni?

MikeDacre commented 6 years ago

Alright, so running /Applications/Oni.app/Contents/Resources/app/oni.sh with or without the --debug flag results in it running just fine, but clicking the app icon results in the same error (no nvim editor, the rest of the GUI works fine) as before.

Here is the debug log from running from the command line (works): oni_debug.log

Here is the debug log from running from the app icon (doesn't work): oni_error.log

Getting similar errors to the one in my first report:

0.bundle.js:182 Uncaught (in promise) TypeError: Cannot read property 'request' of undefined
    at T.<anonymous> (0.bundle.js:182)
    at Generator.next (<anonymous>)
    at 0.bundle.js:182
    at Promise (<anonymous>)
    at w (0.bundle.js:182)
    at _inputQueue.enqueuePromise (0.bundle.js:182)
    at n (0.bundle.js:64)
    at r._currentPromise.then (0.bundle.js:64)
    at <anonymous>
bundle.js:1 TypeError: Cannot read property 'request' of undefined
    at T.<anonymous> (0.bundle.js:182)
    at Generator.next (<anonymous>)
    at 0.bundle.js:182
    at Promise (<anonymous>)
    at w (0.bundle.js:182)
    at _inputQueue.enqueuePromise (0.bundle.js:182)
    at n (0.bundle.js:64)
    at r._currentPromise.then (0.bundle.js:64)
    at <anonymous>
t.error @ bundle.js:1
0.bundle.js:182 Uncaught (in promise) TypeError: Cannot read property 'request' of undefined
    at T.<anonymous> (0.bundle.js:182)
    at Generator.next (<anonymous>)
    at 0.bundle.js:182
    at Promise (<anonymous>)
    at w (0.bundle.js:182)
    at _inputQueue.enqueuePromise (0.bundle.js:182)
    at n (0.bundle.js:64)
    at r._currentPromise.then (0.bundle.js:64)
    at <anonymous>
akinsho commented 6 years ago

@MikeDacre I just checking locally and found that I'm running neovim 2.3 which isn't to say that that's definitely the cause as I imagine it would have come up sooner but you can try upgrading your version?

bryphe commented 6 years ago

Alright, so running /Applications/Oni.app/Contents/Resources/app/oni.sh with or without the --debug flag results in it running just fine, but clicking the app icon results in the same error (no nvim editor, the rest of the GUI works fine) as before.

This is interesting! This suggests that potentially there is some difference in environment (when starting from the terminal, it inherits environment variables from the terminal instance, whereas when starting from the dock / app icon, it may not get the same set of environment variables).

@MikeDacre - if you press a key in Oni while the blank screen is present when starting from the dock / app icon, does Neovim start at the point? We have an unfortunate experience today where if there is an error when Neovim starts, the editor simply does not load - but pressing a key bypasses that, and then you can try :messages to see the actual error is. (This was fixed in #1354 but isn't in a release build yet - just master).

We've seen issues in the past with Python virtualenvs causing issues with the python provider not loading for Neovim (which then causes problems for Oni...).

modiho commented 6 years ago

I have the same issue, with the same error message. Funny, because @MikeDacre mentioned it works for him under Arch Linux, which is the platform I am on. Let me know if I can help getting to the bottom of this.

MikeDacre commented 6 years ago

@Akin909: The issue is the same even if I completely uninstall neovim everywhere except in Oni, and delete my init.vim file and all configs, so I don't think this is the issue.

@bryphe: You might be onto something with the python virtualenvs point—I have altogether too many instances of python installed:

Quite possibly what is happening is that when I launch from the shell it is using the python environment defined there, which would be the anaconda one, whereas when I run from the app icon it is using the system python, which has nothing installed. Does that seem plausible? I am not at my laptop now, but I can test it when I get home. Any suggestions?

To answer your first question: no, no keypresses do anything, I tried everything I could to try and get it to launch or debug it myself, and the screen just remains blank. If I do too many things, then I can't even quit it without force quitting from the doc.

@modiho: Do you use python environments like I do? If so, do you have the neovim module installed in your root system python?

I did a quick experiment on my Arch Linux machine at work uninstalling the neovim modules in the system python, but it did not replicate the error.

modiho commented 6 years ago

@MikeDacre I have python 3 and 2 installed via pacman (the built-in package manager on arch-linux). I didn't have the python neovim modules installed, but with or without them oni behaves the same. I uninstalled python 3 and tried again without success.

I have not gotten oni to freeze, it's just that the actual editor doesn't show at all. I can use the rest of the GUI just fine and can quit via the menu.

I'll try debugging this by building oni from scratch to get a source-mapped error once I have the time.

modiho commented 6 years ago

The error is TypeError: Cannot read property 'request' of undefined at NeovimInstance.eval (NeovimInstance.ts), referring to this line.

this._neovim is undefined because NeovimProcessSpawner.startNeovim, called from NeovimInstance.start, does not resolve successfully.

Something goes wrong when executing shellEnv in mergeSpawnOptions in Process.ts, and for some reason, execution is not resumed in the catch block.

When I comment out the try...catch, only leaving what's inside the catch block, the neovim editor spawns successfully and oni seems to work as intended.

I have not figured out yet why a) shellEnv() fails and b) why the try {} catch() doesn't work. Especially b) confuses me.

akinsho commented 6 years ago

@modiho thats interesting there's definitely been an issue re the neovim process starting up which is what leads to the request of undefined and other issues as you point out. I wonder if you try the sync version of shell env aka (shellEnv.sync) so no promises or try having it imported at the top of the file as opposed to a dynamic import does that change anything?

ShellEnv is how we get a user's env variables which neovim requires of loads of things like pyenv, goroot etc. and not having them was a source of major issues, but I'm wondering if how were importing it and using it is causing some issues

MikeDacre commented 6 years ago

Hm, this could be it for me too, I just had some issues yesterday where my PATH| wasn't being set properly in the terminal, presumably due to something I did a while ago. I actually have to explicitly call the path helper in my.zshrc` now, running bash or zsh without doing that results in no PATH being set.

I wonder if ShellEnv is running into the same thing. Do you think that is possible?

akinsho commented 6 years ago

@MikeDacre that definitely a place where shellEnv / oni start up can fall down as we check a users shell to get the path so if there is some issue re how the path is set tbh I'm not really sure how shell env would behave.

When you say you have to explicitly call a path helper can I ask what you mean are you exporting a PATH variable or using shell fn?

Also if you open oni --debug and type process.env in the console can you post what the output of that command is?

MikeDacre commented 6 years ago

@Akin909 I mean that in my zshrc I have to add this command:

# Use Mac Path Helper
if [ -x /usr/libexec/path_helper ]; then
    eval `/usr/libexec/path_helper -s`
    PATH="/usr/local/bin:/usr/local/sbin:$PATH"
fi

Without those lines, I have no $PATH set at all by default.

Here is the result of process.env when launch Oni from the app icon without --debug (just opening developer tools directly):

process.env
Object {TMPDIR: "/var/folders/v4/j87mz36d4r94q5hvw8nwd22m0000gn/T/", __CF_USER_TEXT_ENCODING: "0x1F5:0x0:0x0", HOME: "/Users/dacre", SHELL: "/usr/local/bin/zsh", Apple_PubSub_Socket_Render: "/private/tmp/com.apple.launchd.dLt1Jfk3jb/Render"…}

Here is the result of process.env (with some variables deleted) when starting Oni from the command line with --debug:

process.env
Object {LSCOLORS: "Gxfxcxdxbxegedabagacad", ITERM_SESSION_ID: "w0t0p0:D7F57F18-81C2-4CC6-B2B9-34EC0F8F307D", DISABLE_AUTO_UPDATE: "true", __CF_USER_TEXT_ENCODING: "0x1F5:0x0:0x0", PER_DIRECTORY_HISTORY_TOGGLE: "^h"…}DISPLAY: "/private/tmp/com.apple.launchd.KDsgo5yjln/org.macosforge.xquartz:0"EDITOR: "nvim"GOOGLE_API_KEY: "AIzaSyAQfxPJiounkhOjODEO5ZieffeBv6yft2Q"ITERM_PROFILE: "Default"KEYTIMEOUT: "1"LANG: "en_US.UTF-8"LC_ALL: "en_US.UTF-8"LC_CTYPE: "C"LESS: "-FX"LOGNAME: "dacre"LSCOLORS: "Gxfxcxdxbxegedabagacad"LS_COLORS: "no=00:fi=00:rs=0:di=00;38;5;74;48;5;232:ln=00;38;5;159:or=00;38;5;159;48;5;236:mh=00:pi=48;5;230;38;5;136;01:so=48;5;230;38;5;136;01:do=48;5;230;38;5;136;01:bd=48;5;230;38;5;244;01:cd=48;5;230;38;5;244;01:su=48;5;160;38;5;230:sg=48;5;136;38;5;230:ca=30;41:tw=48;5;64;38;5;230:ow=48;5;235;38;5;33:st=48;5;33;38;5;230:ex=00;35;5;35:*.tar=00;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=00;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=00;31:*.7z=01;31:*.rz=01;31:*.apk=01;31:*.gem=01;31:*.jpg=00;38;5;136:*.JPG=00;38;5;136:*.jpeg=00;38;5;136:*.gif=00;38;5;136:*.bmp=00;38;5;136:*.pbm=00;38;5;136:*.pgm=00;38;5;136:*.ppm=00;38;5;136:*.tga=00;38;5;136:*.xbm=00;38;5;136:*.xpm=00;38;5;136:*.tif=00;38;5;136:*.tiff=00;38;5;136:*.png=00;38;5;136:*.PNG=00;38;5;136:*.svg=00;38;5;136:*.svgz=00;38;5;136:*.mng=00;38;5;136:*.pcx=00;38;5;136:*.dl=00;38;5;136:*.xcf=00;38;5;136:*.xwd=00;38;5;136:*.yuv=00;38;5;136:*.cgm=00;38;5;136:*.emf=00;38;5;136:*.eps=00;38;5;136:*.CR2=00;38;5;136:*.ico=00;38;5;136:*.tex=00;38;5;245:*.rdf=00;38;5;245:*.owl=00;38;5;245:*.n3=00;38;5;245:*.ttl=00;38;5;245:*.nt=00;38;5;245:*.torrent=00;38;5;245:*.xml=00;38;5;245:*Makefile=00;38;5;245:*Rakefile=00;38;5;245:*build.xml=00;38;5;245:*rc=00;38;5;245:*1=00;38;5;245:*.nfo=00;38;5;245:*README=00;38;5;245:*README.txt=00;38;5;245:*readme.txt=00;38;5;245:*.md=00;38;5;245:*README.markdown=00;38;5;245:*.ini=00;38;5;245:*.yml=00;38;5;245:*.cfg=00;38;5;245:*.conf=00;38;5;245:*.c=00;38;5;245:*.cpp=00;38;5;245:*.cc=00;38;5;245:*.sqlite=00;38;5;245:*.log=00;38;5;240:*.bak=00;38;5;240:*.aux=00;38;5;240:*.lof=00;38;5;240:*.lol=00;38;5;240:*.lot=00;38;5;240:*.out=00;38;5;240:*.toc=00;38;5;240:*.bbl=00;38;5;240:*.blg=00;38;5;240:*~=00;38;5;240:*#=00;38;5;240:*.part=00;38;5;240:*.incomplete=00;38;5;240:*.swp=00;38;5;240:*.tmp=00;38;5;240:*.temp=00;38;5;240:*.o=00;38;5;240:*.pyc=00;38;5;240:*.class=00;38;5;240:*.cache=00;38;5;240:*.aac=00;38;5;166:*.au=00;38;5;166:*.flac=00;38;5;166:*.mid=00;38;5;166:*.midi=00;38;5;166:*.mka=00;38;5;166:*.mp3=00;38;5;166:*.mpc=00;38;5;166:*.ogg=00;38;5;166:*.ra=00;38;5;166:*.wav=00;38;5;166:*.m4a=00;38;5;166:*.axa=00;38;5;166:*.oga=00;38;5;166:*.spx=00;38;5;166:*.xspf=00;38;5;166:*.mov=00;38;5;166:*.mpg=00;38;5;166:*.mpeg=00;38;5;166:*.m2v=00;38;5;166:*.mkv=00;38;5;166:*.ogm=00;38;5;166:*.mp4=00;38;5;166:*.m4v=00;38;5;166:*.mp4v=00;38;5;166:*.vob=00;38;5;166:*.qt=00;38;5;166:*.nuv=00;38;5;166:*.wmv=00;38;5;166:*.asf=00;38;5;166:*.rm=00;38;5;166:*.rmvb=00;38;5;166:*.flc=00;38;5;166:*.avi=00;38;5;166:*.fli=00;38;5;166:*.flv=00;38;5;166:*.gl=00;38;5;166:*.m2ts=00;38;5;166:*.divx=00;38;5;166:*.webm=00;38;5;166:*.axv=00;38;5;166:*.anx=00;38;5;166:*.ogv=00;38;5;166:*.ogx=00;38;5;166:*.savedSearch=01;105:*.fa=1;4;35:*.pep=1;4;35:*.fasta=1;4;35:*.afa=1;4;35:*.phy=1;4;35:*.phy_phyml_tree.txt=4;36:*.phb=4;33:*.xls=32:*.xlsx=32:*sub.log=37:*hup.out=37:*.pl=01;38;5;124:*.py=01;38;5;124:"MODULEPATH: ""MYZSH: "/Users/dacre/.my-zsh"ONI_CWD: "/Users/dacre"PAGER: "less -r"PATH: "/Users/dacre/anaconda3/bin:/Users/dacre/anaconda/bin:/Users/dacre/.local/bin:/Users/dacre/usr/bin:/Users/dacre/tools/bin:/Users/dacre/mike_tools/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/opt/X11/bin:/Users/dacre/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/Applications/Oni.app/Contents/Frameworks/Oni:Helper.app/Contents/MacOS:/Users/dacre/.antigen/bundles/zsh-users/zsh-completions:/Users/dacre/.antigen/bundles/zsh-users/zsh-syntax-highlighting:/Users/dacre/.antigen/bundles/zsh-users/zsh-autosuggestions:/Users/dacre/.antigen/bundles/MikeDacre/cdbk"PER_DIRECTORY_HISTORY_TOGGLE: "^h"PWD: "/Users/dacre"PYTHON3PATH: ""PYTHONPATH: "/Users/dacre/mike_tools/python"ROOTSYS: "/usr/etc/root"R_HISTFILE: "/Users/dacre/.Rhistory"SHELL: "/usr/local/bin/zsh"TERM: "xterm-256color"TERM_PROGRAM: "iTerm.app"TERM_PROGRAM_VERSION: "3.1.6beta3"TERM_SESSION_ID: "w0t0p0:D7F57F18-81C2-4CC6-B2B9-34EC0F8F307D"TMPDIR: "/var/folders/v4/j87mz36d4r94q5hvw8nwd22m0000gn/T/"TZ: "America/Los_Angeles"USER: "dacre"VIM_CRONTAB: "true"VIM_MARKDOWN: "1"VIM_YCM: "1"VISUAL: "vim"XPC_FLAGS: "0x0"XPC_SERVICE_NAME: "0"ZSH: "/Users/dacre/.oh-my-zsh"ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE: "fg=12"mapfile: "zsh/mapfile"_: "/usr/bin/env"__CF_USER_TEXT_ENCODING: "0x1F5:0x0:0x0"__proto__: Object

So when I launch from the command line it gets my entire shell profile, when calling from the app icon it gets almost nothing at all... but it is trying to use the ZSH shell, but without sourcing my zshrc.

akinsho commented 6 years ago

@MikeDacre shell-env works by looking for an exported path variable, not an expert on the nuances of shell scripting but I'm wondering if the snippet above from your zshrc actually results in an accessible $PATH aka in terminal if try to print the path do you have one accessible, if so then it seems very likely that shell env is unable to access it.

Oni doesn't actually read a user's zshrc as tbh all we actually need is the exported path variable for nvim, which I think is very likely the reason for oni not opening as I believe nvim depending on your config needs access to you python path etc.

One thought is that you can explicitly set those in your init.vim using python host prg setting cant remember the specifics but the docs have them.

Another alternative is to trying to set up a regular path export EXPORT PATH ="path" not sure the circumstances around the function helper but it seems like the only way to access the path variable is by first executing the shell command in the if statement

modiho commented 6 years ago

In my case, the issue was that I launched another shell at the end of my .bashrc, so the command that is executed by shell-env never terminated. My bad!

This might be filed as a user error, but maybe we should add a timeout to the shell-env execution to get a proper error message.