Hyper: A JavaScript error occurred in the main process

Created on 12 Jul 2018  ·  12Comments  ·  Source: vercel/hyper

  • [x] I am on the latest Hyper.app version
  • [x] I have searched the issues of this repo and believe that this is not a duplicate
  • OS version and name:
  • Hyper.app version:
  • Link of a Gist with the contents of your .hyper.js:
  • Relevant information from devtools _(CMD+ALT+I on macOS, CTRL+SHIFT+I elsewhere)_:
  • The issue is reproducible in vanilla Hyper.app:

Issue


Uncaught Exception:
Error: Unable to start terminal process:CreateProcess failed

``// 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',

// 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
//C:\\Windows\\System32\\bash.exe`
//
// PowerShell on Windows
// - Example: `C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`
shell: 'C:\\Windows\\System32\\wsl.exe',

//shell: 'C:\Windows\System32\bash.exe',
shellArgs: [''],
// for setting shell arguments (i.e. for using interactive shellArgs: ['-i'])
// by default ['--login'] will be used

// 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: true,

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

// 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 installed
localPlugins: [],

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

Most helpful comment

Getting the same top level error on OSX

detail pane:

Uncaught Exception:
TypeError: Cannot read property 'resize' of undefined
    at Server.Window.rpc.on (/private/var/folders/zs/7fw0j14s67567x864z6zdk_m0000z8/T/AppTranslocation/FAFA91BD-97AC-405C-AD1C-C52FD8255501/d/Hyper.app/Contents/Resources/app.asar/ui/window.js:146:14)
    at emitOne (events.js:115:13)
    at Server.emit (events.js:210:7)
    at Server.ipcListener (/private/var/folders/zs/7fw0j14s67567x864z6zdk_m0000z8/T/AppTranslocation/FAFA91BD-97AC-405C-AD1C-C52FD8255501/d/Hyper.app/Contents/Resources/app.asar/rpc.js:33:11)
    at emitTwo (events.js:125:13)
    at EventEmitter.emit (events.js:213:7)
    at WebContents.<anonymous> (/private/var/folders/zs/7fw0j14s67567x864z6zdk_m0000z8/T/AppTranslocation/FAFA91BD-97AC-405C-AD1C-C52FD8255501/d/Hyper.app/Contents/Resources/electron.asar/browser/api/web-contents.js:266:13)
    at emitTwo (events.js:125:13)
    at WebContents.emit (events.js:213:7)

All 12 comments

I believe I've been able to reproduce this error when setting the shell of hyper to wsl.exe or ubuntu.exe instead of the normal bash.exe. Seems like there's an issue with trying to set the shell to wsl using anything other than bash.exe.

If there are users who'd rather not use bash.exe and rather would like to run wsl.exe (like in my case I just want zsh to start up every time instead of bash) there is a workaround:

shell: 'C:\\Windows\\System32\\cmd.exe',
shellArgs: ['--login', '-i', '/c wsl'],

Adding to the workarounds; it seems if you open a new cmd/Shell tab (and leave it as cmd/Shell) you can open more tabs, or split panes, and not receive the error. You do not have to be on the cmd/Shell tab for this to work. It just seems it is necessary to have one open to prevent the errors.

Edit: This is on Win 10. Seems pcnate has determined it might not be an issue on native Linux?

I had this issue on Windows 10. I tried it just now on Pop OS 18.04 with no plugins and I don't have the issue. Either it is something to do with powershell or to do with the hypercwd plugin

Or the OS

Getting the same top level error on OSX

detail pane:

Uncaught Exception:
TypeError: Cannot read property 'resize' of undefined
    at Server.Window.rpc.on (/private/var/folders/zs/7fw0j14s67567x864z6zdk_m0000z8/T/AppTranslocation/FAFA91BD-97AC-405C-AD1C-C52FD8255501/d/Hyper.app/Contents/Resources/app.asar/ui/window.js:146:14)
    at emitOne (events.js:115:13)
    at Server.emit (events.js:210:7)
    at Server.ipcListener (/private/var/folders/zs/7fw0j14s67567x864z6zdk_m0000z8/T/AppTranslocation/FAFA91BD-97AC-405C-AD1C-C52FD8255501/d/Hyper.app/Contents/Resources/app.asar/rpc.js:33:11)
    at emitTwo (events.js:125:13)
    at EventEmitter.emit (events.js:213:7)
    at WebContents.<anonymous> (/private/var/folders/zs/7fw0j14s67567x864z6zdk_m0000z8/T/AppTranslocation/FAFA91BD-97AC-405C-AD1C-C52FD8255501/d/Hyper.app/Contents/Resources/electron.asar/browser/api/web-contents.js:266:13)
    at emitTwo (events.js:125:13)
    at WebContents.emit (events.js:213:7)

@kamelkev I had the exact problem that you had but in Windows 10

[Main Instruction]
A JavaScript error occurred in the main process

[Content]
Uncaught Exception:
TypeError: Cannot read property 'resize' of undefined
    at Server.Window.rpc.on (C:\Users\Nour\AppData\Local\hyper\app-2.0.0\resources\app.asar\ui\window.js:146:14)
    at emitOne (events.js:115:13)
    at Server.emit (events.js:210:7)
    at Server.ipcListener (C:\Users\Nour\AppData\Local\hyper\app-2.0.0\resources\app.asar\rpc.js:33:11)
    at emitTwo (events.js:125:13)
    at EventEmitter.emit (events.js:213:7)
    at WebContents.<anonymous> (C:\Users\Nour\AppData\Local\hyper\app-2.0.0\resources\electron.asar\browser\api\web-contents.js:266:13)
    at emitTwo (events.js:125:13)
    at WebContents.emit (events.js:213:7)

and I managed to solve it using this configuration:

shell: 'C:\\Program Files\\WindowsApps\\CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2018.817.0_x64__79rhkp1fndgsc\\ubuntu1804.exe',

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

I'm not sure if that helps you, but it might give you a hint as to where to look.

so this is using bash on windows 10? What happens when Ubuntu 18.04onWindows becomes 18.10onWindows?

@pcnate I guess you have to change the config file again :)
Do you have a better solution?

You have git settings diffrent place. Open preferences file for hyper then find this line
shell: 'C:\Program Files\Git\git-cmd.exe',
Then change the path for git-cmd.exe and it will work. I had the same issue and fixed it like that. Easy steps.
Or (one of them will show up in the preferences file)
// Bash on Windows
//C:\Windows\System32\bash.exe`

Then change the path for bash.exe and it will work. I had the same issue and fixed it like that. Easy steps.

I am having the same issue. i had the following settings:

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

after changing it back to:

shell: 'C:\\Windows\\System32\\cmd.exe',
shellArgs: ['--login'],

I could open new tabs. but if i try @tlmurphy's work around i still get the same error as OP.
so no new tabs when working in wsl shell?

If anyone is still having these issues just change your shell
from:

shell: 'C:\\Windows\\System32\\wsl.exe', // whatever your default choice was
shellArgs: [],

to:

shell: 'C:\\Windows\\System32\\bash.exe', // or cmd whatever your choice
shellArgs: ['--login'],

then do a full reload with Crtl+Shift+F5
never do a regular reload when making changes. For some reason it doesn't work too well. And you'll end up making mistakes and receiving the A JavaScript error occurred in the main process error.

Anyways, thanks to @0xBABA's solution it gave me a grip to approach the issue

I have no idea how to change shells.

My hyper wont work and i get this error: https://imgur.com/K93mbxj

I've installed hyper, then gitbash and then I applied thise setting to hyper:
https://gist.github.com/coco-napky/404220405435b3d0373e37ec43e54a23

now hyper shows that error message and no text is appearing. any idea how to fix it?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anthonyettinger picture anthonyettinger  ·  3Comments

hxnt picture hxnt  ·  3Comments

cilice picture cilice  ·  3Comments

ConstantinChirila picture ConstantinChirila  ·  3Comments

cooperpellaton picture cooperpellaton  ·  3Comments