0mkara / etheratom

Solidity compilation and Ethereum contract execution interface for hackable atom editor
https://atom.io/packages/etheratom
GNU General Public License v3.0
252 stars 41 forks source link

Uncaught TypeError: Cannot read property 'replace' of undefined #40

Closed larslue closed 6 years ago

larslue commented 7 years ago

Hey, I tried your etheratom package but it doesn't compile my code. I cannot get further than getting the following error message.

  1. Install etheratom
  2. Open *.sol file
  3. Right click -> Activate etheratom
  4. Select "Backend ethereum node", switch back to "Javascript VM"
  5. Click compile
  6. Boom and break!

Atom: 1.16.0 x64 Electron: 1.3.13 OS: Mac OS X 10.12.4 Thrown From: etheratom package 3.0.0

Stack Trace

Uncaught TypeError: Cannot read property 'replace' of undefined

At /Users/lars/.atom/packages/etheratom/node_modules/react-dom/lib/ReactErrorUtils.js:51

TypeError: Cannot read property 'replace' of undefined
    at VMEnv.compile (/packages/etheratom/lib/vm/vm.js:189:22)
    at /packages/etheratom/lib/vm/vm.js:161:9
    at Workspace.observeTextEditors (/app.asar/src/workspace.js:305:53)
    at VMEnv.subscribeToCompileEvents (/packages/etheratom/lib/vm/vm.js:157:48)
    at /packages/etheratom/lib/vm/vm.js:94:9)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/app.asar/src/command-registry.js:259:29)
    at CommandRegistry.handleCommandEvent (/app.asar/src/command-registry.js:3:59)
    at CommandRegistry.module.exports.CommandRegistry.dispatch (/app.asar/src/command-registry.js:160:19)
    at _handleSubmit (/packages/etheratom/lib/vm/view.js:124:26)
    at Object.invokeGuardedCallback (/packages/etheratom/node_modules/react-dom/lib/ReactErrorUtils.js:26:5)
    at executeDispatch (/packages/etheratom/node_modules/react-dom/lib/EventPluginUtils.js:85:21)
    at Object.executeDispatchesInOrder (/packages/etheratom/node_modules/react-dom/lib/EventPluginUtils.js:108:5)
    at executeDispatchesAndRelease (/packages/etheratom/node_modules/react-dom/lib/EventPluginHub.js:43:22)
    at executeDispatchesAndReleaseTopLevel (/packages/etheratom/node_modules/react-dom/lib/EventPluginHub.js:54:10)
    at Array.forEach (native)
    at forEachAccumulated (/packages/etheratom/node_modules/react-dom/lib/forEachAccumulated.js:24:9)
    at Object.processEventQueue (/packages/etheratom/node_modules/react-dom/lib/EventPluginHub.js:257:7)
    at runEventQueueInBatch (/packages/etheratom/node_modules/react-dom/lib/ReactEventEmitterMixin.js:17:18)
    at /packages/etheratom/node_modules/react-dom/lib/ReactEventEmitterMixin.js:28:5)
    at handleTopLevelImpl (/packages/etheratom/node_modules/react-dom/lib/ReactEventListener.js:72:24)
    at ReactDefaultBatchingStrategyTransaction.perform (/packages/etheratom/node_modules/react-dom/lib/Transaction.js:140:20)
    at Object.batchedUpdates (/packages/etheratom/node_modules/react-dom/lib/ReactDefaultBatchingStrategy.js:62:26)
    at Object.batchedUpdates (/packages/etheratom/node_modules/react-dom/lib/ReactUpdates.js:97:27)
    at dispatchEvent (/packages/etheratom/node_modules/react-dom/lib/ReactEventListener.js:147:20)

Commands

     -7:30.1.0 core:move-down (input.hidden-input)
     -7:28.2.0 snippets:next-tab-stop (input.hidden-input)
     -7:28.2.0 snippets:expand (input.hidden-input)
     -7:28.1.0 editor:indent (input.hidden-input)
     -5:10.7.0 eth-interface:compile (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-one-dark-syntax.theme-one-dark-ui)
     -5:06.2.0 eth-interface:activate (div.line)
     -2:14.6.0 editor:newline (input.hidden-input)
  9x -2:08.9.0 core:backspace (input.hidden-input)
  2x -2:01.3.0 editor:move-to-beginning-of-word (input.hidden-input)
  6x -1:28.8.0 core:backspace (input.hidden-input)
     -1:18.5.0 eth-interface:activate (div.lines)
  2x -1:16.6.0 eth-interface:compile (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-one-dark-syntax.theme-one-dark-ui)
     -0:18.4.0 eth-interface:activate (div.line)
     -0:16.9.0 settings-view:open (input.hidden-input)
     -0:06.5.0 eth-interface:activate (div.line.cursor-line)
     -0:04.5.0 eth-interface:compile (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-one-dark-syntax.theme-one-dark-ui)

Non-Core Packages

atom-beautify 0.29.24 
autocomplete-solidity 0.3.3 
etheratom 3.0.0 
fix-indent-on-paste 0.1.1 
language-javascript-jsx 0.3.7 
language-scala 1.1.8 
linter-solidity 0.5.0 
pig 1.0.0 
0mkara commented 7 years ago

Though I was not able to reproduce this bug in my environment, I think 2ca88fcf8ca8c1f6a9eaa5835dd934d7a446d588 will solve your issue. Please try and let me know if it still exists @larslue

larslue commented 7 years ago

The issue still persists on version 3.0.1 though I think the code is compiled correctly. Maybe the success messages fail and the code compilation works. I tried it on the java vm without a parity node running.

skywinder commented 7 years ago

[Enter steps to reproduce:]

  1. Compile any simple script cause this crash
  2. something doesn't work in geth:

UPDATE:

eth_getCompilers() ReferenceError: 'eth_getCompilers' is not defined at :1:1


Atom: 1.19.0 x64 Electron: 1.6.9 OS: Mac OS X 10.12.6 Thrown From: etheratom package 3.1.0

Stack Trace

Uncaught TypeError: Cannot read property 'replace' of undefined

At /Users/petrkorolev/.atom/packages/etheratom/lib/vm/vm.js:190

TypeError: Cannot read property 'replace' of undefined
    at VMEnv.compile (/packages/etheratom/lib/vm/vm.js:190:23)
    at /packages/etheratom/lib/vm/vm.js:161:9
    at Workspace.observeTextEditors (/Applications/Atom.app/Contents/Resources/app/src/workspace.js:717:15)
    at VMEnv.subscribeToCompileEvents (/packages/etheratom/lib/vm/vm.js:157:48)
    at /packages/etheratom/lib/vm/vm.js:94:9)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:265:35)
    at /Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:65
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:610:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:401:28)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:100:42)
    at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:3:65)

Commands

     -3:21.2.0 intentions:highlight (input.hidden-input)
  2x -3:18.7.0 eth-interface:compile (input.hidden-input)
     -3:11.5.0 intentions:highlight (input.hidden-input)
     -2:54.3.0 settings-view:open (input.hidden-input)
     -1:29.6.0 eth-interface:compile (div.tool-panel.tree-view)
  3x -1:23.1.0 core:copy (atom-notification.fatal.icon.icon-bug.native-key-bindings.has-detail.has-close.has-stack)
     -0:03.1.0 eth-interface:compile (div.tool-panel.tree-view)

Non-Core Packages

autocomplete-go 1.1.0 
autocomplete-solidity 0.3.3 
builder-go 1.0.0 
busy-signal 1.4.3 
environment 1.3.1 
etheratom 3.1.0 
git-plus 7.9.3 
go-config 1.2.2 
go-get 1.0.3 
gofmt 1.1.6 
gometalinter-linter 1.1.0 
gorename 1.0.2 
intentions 1.1.5 
language-ethereum 0.3.9 
linter 2.2.0 
linter-solidity 0.5.0 
linter-ui-default 1.6.4 
linter-write-good 0.9.0 
multi-cursor 2.1.5 
navigator-godef 1.0.3 
rst-preview 1.3.1 
script 3.15.0 
tester-go 1.0.4 
tree-view-git-status 1.4.0 
superpi15 commented 6 years ago

Hi, I got the same problem on the latest version.

[Enter steps to reproduce:]

  1. compile any contract.
  2. crash.

Atom: 1.24.0-beta3 x64 Electron: 1.6.15 OS: Ubuntu 17.10 Thrown From: etheratom package 4.0.0

Stack Trace

Uncaught TypeError: Cannot read property 'replace' of undefined

At /home/nhspc/etheratom/node_modules/react-dom/lib/ReactErrorUtils.js:49

TypeError: Cannot read property 'replace' of undefined
    at VMEnv.compile (/home/nhspc/etheratom/lib/vm/vm.js:189:22)
    at /home/nhspc/etheratom/lib/vm/vm.js:161:9
    at Workspace.observeTextEditors (/usr/share/atom-beta/resources/app/src/workspace.js:728:15)
    at VMEnv.subscribeToCompileEvents (/home/nhspc/etheratom/lib/vm/vm.js:157:48)
    at HTMLElement.<anonymous> (/home/nhspc/etheratom/lib/vm/vm.js:94:9)
    at CommandRegistry.handleCommandEvent (/usr/share/atom-beta/resources/app/src/command-registry.js:388:36)
    at CommandRegistry.dispatch (/usr/share/atom-beta/resources/app/src/command-registry.js:273:23)
    at Object._handleSubmit (/home/nhspc/etheratom/lib/vm/view.js:124:26)
    at Object.invokeGuardedCallback (/home/nhspc/etheratom/node_modules/react-dom/lib/ReactErrorUtils.js:24:5)
    at executeDispatch (/home/nhspc/etheratom/node_modules/react-dom/lib/EventPluginUtils.js:83:21)
    at Object.executeDispatchesInOrder (/home/nhspc/etheratom/node_modules/react-dom/lib/EventPluginUtils.js:106:5)
    at executeDispatchesAndRelease (/home/nhspc/etheratom/node_modules/react-dom/lib/EventPluginHub.js:41:22)
    at executeDispatchesAndReleaseTopLevel (/home/nhspc/etheratom/node_modules/react-dom/lib/EventPluginHub.js:52:10)
    at Array.forEach (native)
    at forEachAccumulated (/home/nhspc/etheratom/node_modules/react-dom/lib/forEachAccumulated.js:22:9)
    at Object.processEventQueue (/home/nhspc/etheratom/node_modules/react-dom/lib/EventPluginHub.js:252:7)
    at runEventQueueInBatch (/home/nhspc/etheratom/node_modules/react-dom/lib/ReactEventEmitterMixin.js:15:18)
    at Object.handleTopLevel [as _handleTopLevel] (/home/nhspc/etheratom/node_modules/react-dom/lib/ReactEventEmitterMixin.js:25:5)
    at handleTopLevelImpl (/home/nhspc/etheratom/node_modules/react-dom/lib/ReactEventListener.js:70:24)
    at ReactDefaultBatchingStrategyTransaction.perform (/home/nhspc/etheratom/node_modules/react-dom/lib/Transaction.js:141:20)
    at Object.batchedUpdates (/home/nhspc/etheratom/node_modules/react-dom/lib/ReactDefaultBatchingStrategy.js:60:26)
    at Object.batchedUpdates (/home/nhspc/etheratom/node_modules/react-dom/lib/ReactUpdates.js:95:27)
    at dispatchEvent (/home/nhspc/etheratom/node_modules/react-dom/lib/ReactEventListener.js:145:20)

Commands

     -9:57.2.0 eth-interface:compile (input.hidden-input)
 23x -7:20.4.0 core:backspace (input.hidden-input)
     -3:07.4.0 eth-interface:toggle (input.hidden-input)
  2x -3:04.6.0 eth-interface:compile (atom-workspace.workspace.scrollbars-visible-always.theme-one-dark-syntax.theme-one-dark-ui)

Non-Core Packages

etheratom 4.0.0 
0mkara commented 6 years ago

@superpi15 etheratom 4.0.0 is not the correct version, please try etheratom v3.2.0.

superpi15 commented 6 years ago

It works. Thanks.