atom-lupa icon indicating copy to clipboard operation
atom-lupa copied to clipboard

Uncaught TypeError: Cannot read property 'on' of undefined

Open NKjoep opened this issue 9 years ago • 5 comments

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.12.2 Electron Version: 1.3.6 System: Mac OS X 10.12.1 Thrown From: atom-lupa package, v0.7.26

Stack Trace

Uncaught TypeError: Cannot read property 'on' of undefined

At /Users/me/.atom/packages/atom-lupa/node_modules/lupa/plugins/python.js:16

TypeError: Cannot read property 'on' of undefined
    at plugin (/Users/me/.atom/packages/atom-lupa/node_modules/lupa/plugins/python.js:16:15)
    at createNodeObservable (/Users/me/.atom/packages/atom-lupa/node_modules/rx/dist/rx.async.js:316:6)
    at /Users/me/.atom/packages/atom-lupa/node_modules/rx/dist/rx.async.js:357:12
    at getMappersFor (/Users/me/.atom/packages/atom-lupa/node_modules/lupa/src/getMappersFor.js:21:57)
    at file (/Users/me/.atom/packages/atom-lupa/node_modules/lupa/src/analysis.js:38:43)
    at create (/Users/me/.atom/packages/atom-lupa/node_modules/lupa/src/core/core.js:29:34)
    at Object.cache.getOrCreate (/Users/me/.atom/packages/atom-lupa/node_modules/lupa/src/core/core.js:12:54)
    at Object.process (/Users/me/.atom/packages/atom-lupa/node_modules/lupa/src/core/core.js:30:26)
    at AnonymousObserver.files.subscribe.file [as _onNext] (/Users/me/.atom/packages/atom-lupa/node_modules/lupa/src/analysis.js:69:22)
    at AnonymousObserver.Rx.AnonymousObserver.AnonymousObserver.next (/Users/me/.atom/packages/atom-lupa/node_modules/rx/dist/rx.js:1828:12)
    at AnonymousObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/Users/me/.atom/packages/atom-lupa/node_modules/rx/dist/rx.js:1762:31)
    at Subject.onNext (/Users/me/.atom/packages/atom-lupa/node_modules/rx/dist/rx.js:5998:19)
    at filePaths.forEach.path (/Users/me/.atom/packages/atom-lupa/node_modules/lupa/src/analysis.js:115:41)
    at Array.forEach (native)
    at /Users/me/.atom/packages/atom-lupa/node_modules/lupa/src/analysis.js:115:19
    at f (/Users/me/.atom/packages/atom-lupa/node_modules/once/once.js:17:25)
    at Glob.<anonymous> (/Users/me/.atom/packages/atom-lupa/node_modules/lupa/node_modules/glob/glob.js:132:7)
    at emitOne (events.js:96:13)
    at Glob.emit (events.js:188:7)
    at Glob._finish (/Users/me/.atom/packages/atom-lupa/node_modules/lupa/node_modules/glob/glob.js:171:8)
    at done (/Users/me/.atom/packages/atom-lupa/node_modules/lupa/node_modules/glob/glob.js:158:12)
    at Glob._processGlobStar2 (/Users/me/.atom/packages/atom-lupa/node_modules/lupa/node_modules/glob/glob.js:589:12)
    at /Users/me/.atom/packages/atom-lupa/node_modules/lupa/node_modules/glob/glob.js:578:10
    at RES (/Users/me/.atom/packages/atom-lupa/node_modules/inflight/inflight.js:31:16)
    at f (/Users/me/.atom/packages/atom-lupa/node_modules/once/once.js:17:25)
    at lstatcb_ (/Users/me/.atom/packages/atom-lupa/node_modules/lupa/node_modules/glob/glob.js:487:7)
    at RES (/Users/me/.atom/packages/atom-lupa/node_modules/inflight/inflight.js:31:16)
    at f (/Users/me/.atom/packages/atom-lupa/node_modules/once/once.js:17:25)
    at FSReqWrap.oncomplete (fs.js:123:15)

Commands

     -0:19.7.0 command-palette:toggle (atom-text-editor.editor.is-focused)
     -0:15.3.0 atom-lupa:toggle (atom-text-editor.editor)

Config

{
  "core": {
    "allowPendingPaneItems": false,
    "autoHideMenuBar": true,
    "disabledPackages": [
      "tree-view-git-modified",
      "tree-view-finder",
      "tree-view-breadcrumb",
      "flow-ide",
      "grunt-runner"
    ],
    "followSymlinks": false,
    "ignoredNames": [
      ".git",
      ".hg",
      ".svn",
      ".bower-cache",
      ".bower-registry",
      "node_modules",
      "bower_components",
      ".bower-tmp",
      ".tmp",
      ".DS_Store"
    ],
    "packagesWithKeymapsDisabled": [
      "linter",
      "close-tags",
      "atom-lupa",
      "git-blame",
      "symbols-tree-view",
      "grunt-runner"
    ],
    "telemetryConsent": "limited",
    "themes": [
      "one-light-ui",
      "original-mac-classic"
    ]
  },
  "atom-lupa": {
    "shouldShowBreadcrumbs": false
  }
}

Installed Packages

# User
activate-power-mode, v1.1.0 (active)
advanced-open-file, v0.16.4 (inactive)
angularjs, v0.3.5 (active)
angularjs-snippets, v0.10.18 (active)
apathy-theme, v1.10.6 (inactive)
atom-beautify, v0.29.13 (inactive)
atom-bootstrap3, v1.2.12 (inactive)
atom-jade, v0.3.0 (active)
atom-jasmine, v0.8.1 (active)
atom-lupa, v0.7.26 (active)
atom-pair, v2.0.10 (active)
atom-ternjs, v0.16.1 (active)
atom-typescript, v10.1.12 (active)
autoclose-html, v0.23.0 (active)
autocomplete-paths, v1.0.2 (active)
blame, v0.10.0 (inactive)
clipboard-history, v0.6.6 (inactive)
clipboard-plus, v0.5.1 (active)
close-tags, v0.6.0 (inactive)
color-picker, v2.2.3 (active)
copy-filename, v1.0.1 (active)
dash, v1.7.0 (inactive)
docblockr, v0.8.7 (active)
editor-settings, v1.1.2 (active)
editorconfig, v2.0.5 (active)
emmet, v2.4.3 (active)
express-complete, v0.2.0 (active)
file-icons, v1.7.25 (active)
file-type-icons, v1.3.3 (active)
flow-ide, v1.1.9 (inactive)
fold-functions, v0.4.4 (active)
gist, v0.3.1 (inactive)
git-blame, v0.4.11 (inactive)
git-history, v3.2.0 (inactive)
git-log, v0.4.1 (active)
git-time-machine, v1.5.4 (inactive)
github-atom-light-syntax, v0.2.0 (inactive)
gitignore-snippets, v0.2.5 (inactive)
grunt-runner, v0.14.0 (inactive)
Handlebars, v1.6.0 (active)
highlight-selected, v0.11.2 (active)
inc, v0.0.4 (inactive)
javascript-snippets, v1.2.1 (active)
jscs-fixer, v1.2.1 (inactive)
language-ect, v0.4.0 (active)
language-ejs, v0.4.0 (active)
less-than-slash, v0.16.0 (active)
lines, v0.13.1 (inactive)
linter, v1.11.18 (active)
linter-jscs, v4.1.0 (active)
linter-jshint, v3.0.1 (active)
linter-less, v2.6.0 (active)
linter-markdown, v3.0.2 (active)
mac-classic, v0.4.0 (inactive)
node-debugger, v1.9.1 (active)
open-in-browser, v0.4.7 (inactive)
open-path, v0.3.6 (inactive)
original-mac-classic, v0.5.0 (active)
pigments, v0.37.0 (active)
pretty-json, v1.6.1 (active)
project-viewer, v0.3.27 (active)
react, v0.16.1 (active)
save-session, v0.16.0 (active)
sublime-default-syntax, v0.2.7 (inactive)
Sublime-Style-Column-Selection, v1.7.2 (active)
swap-selection, v0.4.0 (inactive)
symbols-tree-view, v0.13.2 (active)
sync-settings, v0.7.2 (active)
synced-sidebar, v0.4.3 (active)
tabs-closer, v0.13.0 (inactive)
todo-show, v1.8.0 (inactive)
tree-view-filter, v0.4.1 (active)
tree-view-git-status, v1.2.0 (active)
wordcount, v2.8.0 (active)
atom-dark-syntax, v0.27.0 (inactive)
atom-dark-ui, v0.52.0 (inactive)
atom-light-syntax, v0.28.0 (inactive)
atom-light-ui, v0.45.0 (inactive)
base16-tomorrow-dark-theme, v1.3.0 (inactive)
base16-tomorrow-light-theme, v1.3.0 (inactive)
one-dark-ui, v1.6.2 (inactive)
one-light-ui, v1.6.2 (active)
one-dark-syntax, v1.5.0 (inactive)
one-light-syntax, v1.5.0 (inactive)
solarized-dark-syntax, v1.0.5 (inactive)
solarized-light-syntax, v1.0.5 (inactive)
about, v1.7.0 (active)
archive-view, v0.62.0 (active)
autocomplete-atom-api, v0.10.0 (active)
autocomplete-css, v0.13.1 (active)
autocomplete-html, v0.7.2 (active)
autocomplete-plus, v2.31.4 (active)
autocomplete-snippets, v1.11.0 (active)
autoflow, v0.27.0 (inactive)
autosave, v0.23.1 (active)
background-tips, v0.26.1 (active)
bookmarks, v0.42.0 (active)
bracket-matcher, v0.82.2 (active)
command-palette, v0.39.0 (active)
deprecation-cop, v0.54.1 (active)
dev-live-reload, v0.47.0 (active)
encoding-selector, v0.22.0 (active)
exception-reporting, v0.40.0 (active)
find-and-replace, v0.202.2 (inactive)
fuzzy-finder, v1.4.0 (active)
git-diff, v1.1.0 (active)
go-to-line, v0.31.0 (inactive)
grammar-selector, v0.48.2 (active)
image-view, v0.60.0 (active)
incompatible-packages, v0.26.1 (active)
keybinding-resolver, v0.35.0 (active)
line-ending-selector, v0.5.0 (active)
link, v0.31.2 (inactive)
markdown-preview, v0.158.8 (active)
metrics, v1.1.1 (active)
notifications, v0.65.1 (active)
open-on-github, v1.2.1 (inactive)
package-generator, v1.0.1 (inactive)
settings-view, v0.243.1 (active)
snippets, v1.0.4 (active)
spell-check, v0.68.4 (active)
status-bar, v1.4.1 (active)
styleguide, v0.47.2 (active)
symbols-view, v0.113.1 (inactive)
tabs, v0.103.0 (active)
timecop, v0.33.2 (active)
tree-view, v0.210.0 (active)
update-package-dependencies, v0.10.0 (active)
welcome, v0.35.1 (active)
whitespace, v0.35.0 (active)
wrap-guide, v0.38.2 (active)
language-c, v0.54.0 (active)
language-clojure, v0.22.1 (active)
language-coffee-script, v0.48.0 (active)
language-csharp, v0.12.1 (active)
language-css, v0.40.1 (active)
language-gfm, v0.88.0 (active)
language-git, v0.15.0 (active)
language-go, v0.43.0 (active)
language-html, v0.46.1 (active)
language-hyperlink, v0.16.1 (active)
language-java, v0.24.0 (active)
language-javascript, v0.122.0 (active)
language-json, v0.18.3 (active)
language-less, v0.29.6 (active)
language-make, v0.22.2 (active)
language-mustache, v0.13.0 (active)
language-objective-c, v0.15.1 (active)
language-perl, v0.37.0 (active)
language-php, v0.37.3 (active)
language-property-list, v0.8.0 (active)
language-python, v0.45.1 (active)
language-ruby, v0.70.2 (active)
language-ruby-on-rails, v0.25.1 (active)
language-sass, v0.57.0 (active)
language-shellscript, v0.23.0 (active)
language-source, v0.9.0 (active)
language-sql, v0.25.0 (active)
language-text, v0.7.1 (active)
language-todo, v0.29.1 (active)
language-toml, v0.18.1 (active)
language-xml, v0.34.12 (active)
language-yaml, v0.27.1 (active)

# Dev
No dev packages

NKjoep avatar Nov 14 '16 15:11 NKjoep

I just realised you already closed a similar issue some months ago, but I still have this problem

NKjoep avatar Nov 14 '16 15:11 NKjoep

it happened when you were editing Python file, right?

Do you have Python interpreter installed on your system? (and what operating system you're working on?)

hex13 avatar Nov 14 '16 18:11 hex13

No, it didn't. I was editing a normal js file.

And yes, I do have a python interpreter since I am running Mac OS X 10.12.1 as you can see from the bug report.

image

NKjoep avatar Nov 14 '16 20:11 NKjoep

I am running Mac OS X 10.12.1 as you can see from the bug report. yes, I overlooked this fact.

No, it didn't. I was editing a normal js file. strange, because in theory python module of Lupa shouldn't be active in other files than *py. I will have to look on it.

hex13 avatar Nov 14 '16 20:11 hex13

I've discovered that script which analyses Python* runs always (even with JavaScript files). This can affects performance ( #36 ) but it shouldn't trigger errors (at least I cannot reproduce this bug - it works on my version of Atom 1.12.5, and it works in CLI on Node 6.0 and on Node 4.6).

I thought first maybe stdio streams are not configured properly in child_process.spawn I will examine that further, but if it works when I run this... I don't know.

Second thing is I've found this StackOverflow thread: http://stackoverflow.com/questions/16170375/nodejs-not-spawning-child-process-except-in-tests kierans (one of StackOverflow users) wrote there: The problem was that the spawn method created on the Object prototype (see this article on Protypical inheritance) was causing the child_process.spawn function to be replaced, so the wrong function was being called.

Maybe that's the case? Maybe some package you've installed replace spawn function on Object.prototype?

I will examine that further.

  • https://github.com/hex13/lupa/blob/master/plugins/python.js

hex13 avatar Nov 25 '16 12:11 hex13