vercel / hyper

A terminal built on web technologies
https://hyper.is
MIT License
43.32k stars 3.52k forks source link

Crashes when `wsl.exe` is selected as shell #2207

Closed iamdevlinph closed 7 years ago

iamdevlinph commented 7 years ago

Issue

Hyperterm crashes when shell: 'C:\\Windows\\System32\\wsl.exe', is set in the config. I noticed this after I updated to 1.4.4. After restarting the app, it just crashes.

Windows also updated before hand but Hyper was not crashing that time.

iamdevlinph commented 7 years ago

I will try the fix mentioned in https://github.com/zeit/hyper/issues/2200 It's about powershell so I didn't bother with it much.

Really sleepy right now so tomorrow i will try it

iamdevlinph commented 7 years ago

Sadly, the fix doesn't work or I'm doing it wrong.

Anyways, I just changed the shell to bash.exe and manually switch to zsh. It's just once a day, so not really that of a hassle. But still annoying.

Stanzilla commented 7 years ago

Why would you want to use wsl.exe over bash.exe?

iamdevlinph commented 7 years ago

So that I can set my default shell to zsh? bash.exe reads a different file than the wsl.exe one.

iamdevlinph commented 7 years ago

Closing.

1.4.6 release fixed the problem

Stanzilla commented 7 years ago

@iamdevlinph oh interesting, how do you do that then?

iamdevlinph commented 7 years ago

I just do a chsh -c zsh (not entirely sure if this is the correct syntax but it's just like what you normally do when setting default shell in linux). wsl.exe reads the file that is generated by that command while bash.exe doesn't.

Stanzilla commented 7 years ago

Oh I see, wsl.exe is new to the Fall Creators update, thanks!

iamdevlinph commented 7 years ago

Ohhh. I just realized you were asking "how I got it". I thought you meant "how I got the default shell" lol.

Yes. It's in the Fall Creators update. Right now, it's only available for the insiders.

Stanzilla commented 6 years ago

https://medium.com/@finnzeit/set-and-use-zsh-as-default-shell-in-wsl-on-windows-10-the-right-way-4f30ed9592dc

For those interested. Make sure you don't have the hypercwd plugin installed, you will get crashes on new tab creation

itsjoel commented 6 years ago

This still isn't working for me. Any fix?

Stanzilla commented 6 years ago

@itsjoel works here, try

shell: 'C:\\Windows\\System32\\wsl.exe',
shellArgs: [],
itsjoel commented 6 years ago

Thanks! It seems that it doesn't work if you have anything in shellArgs, even "". It's working now.

methodbox commented 5 years ago

I'm not sure what happened but this still doesn't work. It doesn't work with git-bash in Windows, either.

dmmarmol commented 5 years ago

Same as @methodbox. Not working for me also

Current settings

shell: 'C:\\Windows\\System32\\wsl.exe',
shellArgs: [],
methodbox commented 5 years ago

Guys I actually fixed this; there’s a few gists out there people have posted that work.

Just google “hyper git-bash config” and reference their settings against yours.

In my case I missed removing —login and for powershell it was something similar.

I was able to get both git-bash and PS working, but as the theming is still pretty trash and their docs about the same I gave it up.

leodutra commented 5 years ago

Sorry, but git-bash is not WSL, nor recommended to use bash.exe on newer versions.

methodbox commented 5 years ago

@leodutra I know this but the OP just wants to use zsh which doesn’t require the baggage of WSL to work - it only requires Git-Bash in Windows.

One might ask WTF you’re using Hyper in Windows for if you’re intention is to actually use WSL? Why not use a GUI inside WSL and install Hyper there?

If, however, you’re goal is the same as the OP, Git-Bash is more than sufficient.

leodutra commented 5 years ago

Well, I stated that and started trying by myself, on my Windows boot. I moved to WSL2, using the Windows insider version and this solved:

Same as @methodbox. Not working for me also

Current settings

shell: 'C:\\Windows\\System32\\wsl.exe',
shellArgs: [],
leodutra commented 5 years ago

For anyone with the same need... I did these steps, more or less: (without a GUI)

Installing Windows Subsystem for Linux 2, Hyper, ZSH, Node.js and VSCode extensions

Requirements

Steps

1. Enable WSL2

Run in PowerShell, as admin (elevated):

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

2. Install a Linux distro for WSL2

3. Install Chocolatey

Run in CMD, as admin:

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

4. Install Hyper and VSCode using Chocolatey

Run in CMD, as admin:

choco install hyper vscode -y

5. Set Hyper to use WSL

    shell: 'C:\\Windows\\System32\\wsl.exe',
    shellArgs: [],

6. Install ZSH and Oh My Zsh

Run in Hyper:

sudo apt install zsh -y
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

7. Install NVM using ZSH

Run in Hyper:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
echo "export NVM_DIR=~/.nvm\n[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> ~/.zshrc
source ~/.zshrc

8. Install Node (latest) using NVM

Run in Hyper:

nvm install node
nvm alias default node

9. Install Yarn

Run in Hyper:

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install --no-install-recommends yarn

10. Install Nodemon, PM2, ESLint, Pug

Run in Hyper:

npm i -g nodemon pm2 eslint pug

11. Install neofetch

Run in Hyper:

nvm install neofetch
echo 'neofetch' >> ~/.zshrc

12. Install VSCode extensions

Run in Hyper:

code --install-extension amandeepmittal.pug
code --install-extension bierner.markdown-preview-github-styles
code --install-extension DavidAnson.vscode-markdownlint
code --install-extension dbaeumer.vscode-eslint
code --install-extension eamodio.gitlens
code --install-extension formulahendry.code-runner
code --install-extension hollowtree.vue-snippets
code --install-extension jianbingfang.dupchecker
code --install-extension ms-vscode.cpptools
code --install-extension ms-vscode.csharp
code --install-extension ms-vscode.vscode-typescript-tslint-plugin
code --install-extension msjsdiag.debugger-for-chrome
code --install-extension naumovs.color-highlight
code --install-extension octref.vetur
code --install-extension pkief.material-icon-theme
code --install-extension ritwickdey.LiveServer
code --install-extension rust-lang.rust
code --install-extension sysoev.language-stylus
code --install-extension WallabyJs.quokka-vscode
code --install-extension yzane.markdown-pdf
code --install-extension yzhang.markdown-all-in-one

13. Upgrade Ubuntu

sudo apt upgrade -y

14. Exit Hyper

Run in Hyper:

exit
leodutra commented 5 years ago

@leodutra I know this but the OP just wants to use zsh which doesn’t require the baggage of WSL to work - it only requires Git-Bash in Windows.

One might ask WTF you’re using Hyper in Windows for if you’re intention is to actually use WSL? Why not use a GUI inside WSL and install Hyper there?

If, however, you’re goal is the same as the OP, Git-Bash is more than sufficient.

BTW, I think Hyper is the best option of a terminal for Windows, for all of those who support well made open-source software.

JoanComasFdz commented 3 years ago

I just followed the steps in @leodutra comment and once I change the shell to wsl, it doesn't load anything inside Hyper, just a pink cursor is shown but no prompt is shown and I can't type.

This is what I see: image

This is the config file:


// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.

module.exports = {
  config: {
    // choose either `'stable'` for receiving highly polished,
    // or `'canary'` for less polished but more frequent updates
    updateChannel: 'stable',

    // default font size in pixels for all tabs
    fontSize: 12,

    // font family with optional fallbacks
    fontFamily: 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',

    // default font weight: 'normal' or 'bold'
    fontWeight: 'normal',

    // font weight for bold characters: 'normal' or 'bold'
    fontWeightBold: 'bold',

    // line height as a relative unit
    lineHeight: 1,

    // letter spacing as a relative unit
    letterSpacing: 0,

    // terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
    cursorColor: 'rgba(248,28,229,0.8)',

    // terminal text color under BLOCK cursor
    cursorAccentColor: '#000',

    // `'BEAM'` for |, `'UNDERLINE'` for _, `'BLOCK'` for █
    cursorShape: 'BLOCK',

    // set to `true` (without backticks and without quotes) for blinking cursor
    cursorBlink: false,

    // color of the text
    foregroundColor: '#fff',

    // terminal background color
    // opacity is only supported on macOS
    backgroundColor: '#000',

    // terminal selection color
    selectionColor: 'rgba(248,28,229,0.3)',

    // border color (window, tabs)
    borderColor: '#333',

    // custom CSS to embed in the main window
    css: '',

    // custom CSS to embed in the terminal window
    termCSS: '',

    // if you're using a Linux setup which show native menus, set to false
    // default: `true` on Linux, `true` on Windows, ignored on macOS
    showHamburgerMenu: '',

    // set to `false` (without backticks and without quotes) if you want to hide the minimize, maximize and close buttons
    // additionally, set to `'left'` if you want them on the left, like in Ubuntu
    // default: `true` (without backticks and without quotes) on Windows and Linux, ignored on macOS
    showWindowControls: '',

    // custom padding (CSS format, i.e.: `top right bottom left`)
    padding: '12px 14px',

    // the full list. if you're going to provide the full color palette,
    // including the 6 x 6 color cubes and the grayscale map, just provide
    // an array here instead of a color map object
    colors: {
      black: '#000000',
      red: '#C51E14',
      green: '#1DC121',
      yellow: '#C7C329',
      blue: '#0A2FC4',
      magenta: '#C839C5',
      cyan: '#20C5C6',
      white: '#C7C7C7',
      lightBlack: '#686868',
      lightRed: '#FD6F6B',
      lightGreen: '#67F86F',
      lightYellow: '#FFFA72',
      lightBlue: '#6A76FB',
      lightMagenta: '#FD7CFC',
      lightCyan: '#68FDFE',
      lightWhite: '#FFFFFF',
    },

    // the shell to run when spawning a new session (i.e. /usr/local/bin/fish)
    // if left empty, your system's login shell will be used by default
    //
    // Windows
    // - Make sure to use a full path if the binary name doesn't work
    // - Remove `--login` in shellArgs
    //
    // Bash on Windows
    // - Example: `C:\\Windows\\System32\\bash.exe`
    //
    // PowerShell on Windows
    // - Example: `C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`
    shell: 'C:\\Windows\\System32\\wsl.exe',

    // for setting shell arguments (i.e. for using interactive shellArgs: `['-i']`)
    // by default `['--login']` will be used
    shellArgs: [],

    // for environment variables
    env: {},

    // set to `false` for no bell
    bell: 'SOUND',

    // if `true` (without backticks and without quotes), selected text will automatically be copied to the clipboard
    copyOnSelect: false,

    // if `true` (without backticks and without quotes), hyper will be set as the default protocol client for SSH
    defaultSSHApp: true,

    // if `true` (without backticks and without quotes), on right click selected text will be copied or pasted if no
    // selection is present (`true` by default on Windows and disables the context menu feature)
    quickEdit: false,

    // choose either `'vertical'`, if you want the column mode when Option key is hold during selection (Default)
    // or `'force'`, if you want to force selection regardless of whether the terminal is in mouse events mode
    // (inside tmux or vim with mouse mode enabled for example).
    macOptionSelectionMode: 'vertical',

    // URL to custom bell
    // bellSoundURL: 'http://example.com/bell.mp3',

    // Whether to use the WebGL renderer. Set it to false to use canvas-based
    // rendering (slower, but supports transparent backgrounds)
    webGLRenderer: true,

    // for advanced config flags please refer to https://hyper.is/#cfg
  },

  // a list of plugins to fetch and install from npm
  // format: [@org/]project[#version]
  // examples:
  //   `hyperpower`
  //   `@company/project`
  //   `project#1.0.1`
  plugins: [],

  // in development, you can create a directory under
  // `~/.hyper_plugins/local/` and include it here
  // to load it and avoid it being `npm install`ed
  localPlugins: [],

  keymaps: {
    // Example
    // 'window:devtools': 'cmd+alt+o',
  },
};

My windows version is: 1909 (18363.1256).

When I add the --login arg, then it shows an error:

Invalid command line option: --login
Copyright (c) Microsoft Corporation. All rights reserved

So i guess somehow WSL is working but the default shell cannot be shown? Any help would be appreciated.