Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Failed to activate the spell-check package #67

Closed
sinejoe opened this issue Jun 22, 2015 · 17 comments
Closed

Failed to activate the spell-check package #67

sinejoe opened this issue Jun 22, 2015 · 17 comments

Comments

@sinejoe
Copy link

sinejoe commented Jun 22, 2015

[Enter steps to reproduce below:]

  1. Launch Atom Editor
  2. Observe errir

Atom Version: 0.211.0
System: Mac OS X 10.10.3
Thrown From: spell-check package, v0.59.0

Stack Trace

Failed to activate the spell-check package

At Cannot read property 'scopeName' of undefined

TypeError: Cannot read property 'scopeName' of undefined
    at SpellCheckView.module.exports.SpellCheckView.spellCheckCurrentGrammar (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/spell-check/lib/spell-check-view.js:77:41)
    at SpellCheckView.module.exports.SpellCheckView.subscribeToBuffer (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/spell-check/lib/spell-check-view.js:64:16)
    at new SpellCheckView (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/spell-check/lib/spell-check-view.js:44:12)
    at addViewToEditor (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/spell-check/lib/main.js:25:12)
    at Workspace.module.exports.Workspace.observeTextEditors (/Applications/Atom.app/Contents/Resources/app.asar/src/workspace.js:276:9)
    at Object.module.exports.activate (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/spell-check/lib/main.js:14:47)
    at Package.module.exports.Package.activateNow (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:240:19)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/package.js:221:30
    at Package.module.exports.Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:165:15)
    at Package.module.exports.Package.activate (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:213:14)

Commands

Config

{
  "core": {
    "themes": [
      "atom-dark-ui",
      "monokai-dark"
    ],
    "ignoredNames": [
      ".git",
      ".svn",
      ".DS_Store",
      ".hg",
      "*.pyc",
      "node_modules"
    ],
    "projectHome": "/var/www",
    "disabledPackages": [
      "wrap-guide"
    ]
  }
}

Installed Packages

# User
Stylus, v1.0.0
atom-minify, v0.1.6
auto-update-packages, v1.0.0
django-templates, v0.5.0
file-types, v0.4.1
fonts, v0.4.2
jshint, v1.3.7
language-liquid, v0.2.0
language-nunjucks, v2.0.0
monokai-dark, v1.3.0
revert-buffer, v0.5.0
sass-autocompile, v0.7.1
save-session, vundefined
text-manipulation, v0.6.0

# Dev
No dev packages
@ghost
Copy link

ghost commented Jun 23, 2015

Same here on Windows 7 Machine

Newest Atom 0.221.0

Installed Packages
git-difftool
git-plus
language-smarty (Failed to activate as well - Cannot read property 'scopeName' of undefined)
language-smarty-php
merge-conflicts
tree-view-git-status

Same error on atom wrap-guide package
Failed to activate the wrap-guide package
TypeError: Cannot read property 'scopeName' of undefined

@furins
Copy link

furins commented Jun 25, 2015

Same here on a mac. Possibly related issue: atom/atom#6235

@izuzak
Copy link
Contributor

izuzak commented Sep 13, 2015

@sinejoe @ElaHo @furins Sorry for the delay in getting back to you on this. Are you still seeing this issue in Atom 1.0.11? If so, do you see the problem when you start Atom in safe mode? Also, can you please provide at least one file for which this error happens so that we can try and reproduce? Or does this happen when you attempt to open any file in any project?

@PhiLhoSoft
Copy link

Using Atom 1.3.2 on Windows 7. I got spell-checking working out of the box on one computer, but when I installed Atom with the same packages and settings on another computer (still Win7), it just doesn't work, without even leaving a stack trace...

Note: the placeholder text in the settings shows: Default: source.asciidoc, source.gfm, text.git-commit, text.plain, text.plain.null-grammar
I try to get spell-checking in Markdown documents (extension: .md). I don't know if this falls into the above categories. The setting descriptions says: "See the README for more information on finding the correct scope for a specific language." but the readme file don't tell anything about these file types, so I am not sure how to add explicitly the Markdown type.

@PhiLhoSoft
Copy link

Update: I removed Atom from the problematic computer. Cleared all three folders (had problems with packages with too deep dependency tree, exceeding the Windows' max length path; solved by moving up node_modules for these packages).

I made a fresh install of Atom 1.3.2. I opened a .md file without changing anything to the settings (so, no 3rd party package, default settings, etc.). Still no spell checking... :-(

The first computer uses Windows 7 Professional; the second one, with the problem, uses Windows 10 (upgraded from 7).
Still no evidence of problem in the console, making my reports a bit useless, alas. I am trying to locate the package' source, to try and debug.

@PhiLhoSoft
Copy link

I located the sources in the DevTools. It was not obvious, because all files start with C:\Users\PhiLho\AppData\Local\atom\app-1.3.2\resources\app.asar\node_modules\ which is near of the limit displayed by DevTools...
I found out that spell checking kicks in, it pass the file to the task, which returns an empty result: no spelling errors found! The task's PID can be seen in the Task Manager, so it is really started. Maybe it was not able to load the dictionary? Maybe the paths are too deep for a non-professional version of Windows?
Throwing in ideas, wild guesses... If you can suggest ways to bring more information...

Side note: there are 6 Atom processes started. When I see the command line of launch, half of them has no quotes around the path to Atom. It is OK on my system as there are no spaces in the path, but on some systems, it might be problematic.

@rcrooks
Copy link

rcrooks commented Apr 1, 2018

Am seeing this issue again in 1.26 beta0
[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.26.0-beta0 x64
Electron: 1.7.11
OS: Mac OS X 10.13.4
Thrown From: spell-check package 0.73.1

Stack Trace

Failed to activate the spell-check package

At Could not find module root given file: "/private/var/folders/m_/zp9plyps3dv8kgnzrx89161h0000gn/T/AppTranslocation/11C6B0EF-4DF2-4E37-A568-84C5AD57478C/d/Atom Beta.app/Contents/Resources/app.asar/node_modules/bindings/bindings.js". Do you have a `package.json` file? 

Error: Could not find module root given file: "/private/var/folders/m_/zp9plyps3dv8kgnzrx89161h0000gn/T/AppTranslocation/11C6B0EF-4DF2-4E37-A568-84C5AD57478C/d/Atom Beta.app/Contents/Resources/app.asar/node_modules/bindings/bindings.js". Do you have a `package.json` file? 
    at Function.getRoot (/app.asar/node_modules/bindings/bindings.js:159:13)
    at bindings (/app.asar/node_modules/bindings/bindings.js:55:32)
    at /app.asar/node_modules/webworker-threads/index.js:1:198)
    at /app.asar/node_modules/webworker-threads/index.js:5:3)
    at Module.get_Module._compile (/private/var/folders/m_/zp9plyps3dv8kgnzrx89161h0000gn/T/AppTranslocation/F420E561-7B99-4411-BF45-18A27B39B78D/d/Atom Beta.app/Contents/Resources/app/src/native-compile-cache.js:106:36)
    at Object.value [as .js] (/private/var/folders/m_/zp9plyps3dv8kgnzrx89161h0000gn/T/AppTranslocation/F420E561-7B99-4411-BF45-18A27B39B78D/d/Atom Beta.app/Contents/Resources/app/src/compile-cache.js:240:29)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (/app.asar/static/index.js:47:45)
    at require (/private/var/folders/m_/zp9plyps3dv8kgnzrx89161h0000gn/T/AppTranslocation/F420E561-7B99-4411-BF45-18A27B39B78D/d/Atom Beta.app/Contents/Resources/app/src/native-compile-cache.js:66:33)
    at /app.asar/node_modules/spelling-manager/node_modules/natural/lib/natural/classifiers/classifier.js:29:19)
    at /app.asar/node_modules/spelling-manager/node_modules/natural/lib/natural/classifiers/classifier.js:461:3)
    at Module.get_Module._compile (/private/var/folders/m_/zp9plyps3dv8kgnzrx89161h0000gn/T/AppTranslocation/F420E561-7B99-4411-BF45-18A27B39B78D/d/Atom Beta.app/Contents/Resources/app/src/native-compile-cache.js:106:36)
    at Object.value [as .js] (/private/var/folders/m_/zp9plyps3dv8kgnzrx89161h0000gn/T/AppTranslocation/F420E561-7B99-4411-BF45-18A27B39B78D/d/Atom Beta.app/Contents/Resources/app/src/compile-cache.js:240:29)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (/app.asar/static/index.js:47:45)
    at require (/private/var/folders/m_/zp9plyps3dv8kgnzrx89161h0000gn/T/AppTranslocation/F420E561-7B99-4411-BF45-18A27B39B78D/d/Atom Beta.app/Contents/Resources/app/src/native-compile-cache.js:66:33)
    at /app.asar/node_modules/spelling-manager/node_modules/natural/lib/natural/classifiers/bayes_classifier.js:24:18)
    at /app.asar/node_modules/spelling-manager/node_modules/natural/lib/natural/classifiers/bayes_classifier.js:61:3)
    at Module.get_Module._compile (/private/var/folders/m_/zp9plyps3dv8kgnzrx89161h0000gn/T/AppTranslocation/F420E561-7B99-4411-BF45-18A27B39B78D/d/Atom Beta.app/Contents/Resources/app/src/native-compile-cache.js:106:36)
    at Object.value [as .js] (/private/var/folders/m_/zp9plyps3dv8kgnzrx89161h0000gn/T/AppTranslocation/F420E561-7B99-4411-BF45-18A27B39B78D/d/Atom Beta.app/Contents/Resources/app/src/compile-cache.js:240:29)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (/app.asar/static/index.js:47:45)
    at require (/private/var/folders/m_/zp9plyps3dv8kgnzrx89161h0000gn/T/AppTranslocation/F420E561-7B99-4411-BF45-18A27B39B78D/d/Atom Beta.app/Contents/Resources/app/src/native-compile-cache.js:66:33)
    at /app.asar/node_modules/spelling-manager/node_modules/natural/lib/natural/index.js:59:27)
    at /app.asar/node_modules/spelling-manager/node_modules/natural/lib/natural/index.js:94:3)
    at Module.get_Module._compile (/private/var/folders/m_/zp9plyps3dv8kgnzrx89161h0000gn/T/AppTranslocation/F420E561-7B99-4411-BF45-18A27B39B78D/d/Atom Beta.app/Contents/Resources/app/src/native-compile-cache.js:106:36)
    at Object.value [as .js] (/private/var/folders/m_/zp9plyps3dv8kgnzrx89161h0000gn/T/AppTranslocation/F420E561-7B99-4411-BF45-18A27B39B78D/d/Atom Beta.app/Contents/Resources/app/src/compile-cache.js:240:29)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)

Commands

Non-Core Packages

aligner 1.2.4 
aligner-css 1.2.1 
aligner-javascript 1.3.0 
aligner-php 1.2.0 
api-workbench 0.8.48 
apidoc-snippets 0.1.1 
atom-beautify 0.32.2 
atom-html-preview 0.2.5 
atom-ide-ui 0.9.4 
atom-json 0.6.0 
atom-json-color 0.6.0 
atom-json-editor 0.4.1 
atom-minify 0.8.0 
atom-package-sync 0.2.6 
atom-ternjs 0.18.3 
autoclose-html 0.23.0 
autocomplete-html-entities 0.2.0 
autocomplete-json 5.5.2 
autoupdate-packages 1.3.1 
ayu-mirage-atom-syntax 1.0.0 
birds-syntax 0.2.1 
block-select 1.0.0 
busy-signal 1.4.3 
city-lights-syntax 1.1.8 
city-lights-ui 1.3.3 
creative-af-syntax 0.1.0 
Delete-Whitelines 0.6.3 
directory-color 0.3.0 
docblockr 0.13.7 
double-tag 1.1.0 
emmet 2.4.3 
fancy-bracket-matcher 2.1.0 
file-icons 2.1.18 
gaia-dark-syntax 2.1.0 
html-to-less 1.2.2 
html-wrapper 0.2.0 
iceberg-syntax 0.2.3 
ide-css 0.3.0 
ide-css-less-scss 0.1.1 
ide-html 0.4.2 
ide-json 0.2.1 
ide-php 0.7.14 
ide-yaml 0.4.2 
indent-guide-improved 1.4.13 
intentions 1.1.5 
javascript-snippets 1.2.1 
json-schema 0.1.15 
language-vtt 0.0.2 
line-number-color 0.2.0 
linter 2.2.0 
linter-htmllint 1.0.1 
linter-js-yaml 1.2.8 
linter-jshint 3.1.6 
linter-languagetool 0.7.1 
linter-raml 1.0.1 
linter-ui-default 1.7.1 
minima-syntax 0.0.2 
minima-ui 0.0.4 
multi-cursor 2.1.5 
NatureBoi 2.0.0 
noir-dark-syntax 0.1.0 
nord-atom-syntax 0.9.1 
nord-atom-ui 0.11.0 
northem-dark-atom-syntax 2.1.0 
northem-dark-atom-ui 2.1.0 
one-liner 0.1.3 
pear-dark-syntax 1.0.6 
pigments 0.40.2 
platformio-ide-terminal 2.8.1 
playa-dark-syntax 2.1.0 
predawn-syntax 1.0.4 
pristine-ui 1.1.11 
quilt-syntax 0.4.0 
rain-syntax 2.1.2 
raml 0.2.0 
raml-snippets 0.1.0 
red-wavy-underline 0.3.3 
select-text-between-tags 0.1.0 
simple-drag-drop-text 0.4.0 
smart-save 0.6.0 
splash-ui 0.4.0 
tag 0.5.0 
talamasca 1.3.0 
teletype 0.11.0 
todo-show 2.2.0 
toggle-quotes 1.1.0 
tree-view-git-branch 0.1.2 
tree-view-git-status 1.4.0 
tuesday-syntax 0.1.2 
w3c-validation 0.4.0 

@jasonrudolph
Copy link
Contributor

@rcrooks: Thanks for letting us know that you're running into this issue. I'm attempting to reproduce it, but I haven't been able to do so. Does it happen for you every time you open Atom?

@rcrooks
Copy link

rcrooks commented Apr 9, 2018

@jasonrudolph no, that's the odd thing. It appears sometimes, but not every time. and only on the beta version (1.26.1, not the release version

@jasonrudolph
Copy link
Contributor

Error: Could not find module root given file: "/private/var/folders/m_/zp9plyps3dv8kgnzrx89161h0000gn/T/AppTranslocation/11C6B0EF-4DF2-4E37-A568-84C5AD57478C/d/Atom Beta.app/Contents/Resources/app.asar/node_modules/bindings/bindings.js". Do you have a `package.json` file?
    at Function.getRoot (/app.asar/node_modules/bindings/bindings.js:159:13)
    at bindings (/app.asar/node_modules/bindings/bindings.js:55:32)
    at /app.asar/node_modules/webworker-threads/index.js:1:198)

@maxbrunsfeld @as-cii: Do you see anything in that stack trace ☝️ that might offer a hint as to the root cause of this issue? I'd love to resolve this problem before Atom 1.26 graduates from beta to stable.

@maxbrunsfeld
Copy link
Contributor

The error looks like it's related to the webworker-threads module, a dependency of the spelling-manager module, which was added by @dmoonfire in #120.

I'm not familiar with webworker-threads but it looks like it is a native module that lets you write multi-threaded javascript code.

It seems that it uses an old node module called bindings that automatically find the location of a native node module that you're trying to require. We typically don't use bindings for the native modules that we use elsewhere in Atom; we just require native modules using normal hard-coded paths. It's possible that bindings is interacting badly with asar?

@dmoonfire do you have any insight into what might be going on here?

@jasonrudolph
Copy link
Contributor

@maxbrunsfeld: Thanks for that insight. 🙇⚡ tl;dr I think we might be able to resolve this issue by omitting the webworker-threads module from the build. I've described my findings so far below. Does this idea seem reasonable? If so, is there a preferred way to omit the webworker-threads module from the build?

Findings

Here's the dependency chain I'm seeing:

spell-check ➡️ spelling-manager ➡️ natural ➡️ webworker-threads ➡️ bindings

I think the issue we're seeing has to due with natural's dependency on webworker-threads. I came across a few other people mentioning issues attempting to use the webworker-threads module with Electron:

The natural module declares webworker-threads as an optionalDependency (NaturalNode/natural#354). If webworker-threads is installed, the natural module attempts to use it [code].

NaturalNode/natural#368 explains that deleting the the webworker-threads module only works on Node, and not on Electron.

NaturalNode/natural#368 goes on to say that you can work around the issue by deleting the node_modules/webworker-threads folder after installing the natural module. I tried that, and it seems to do the trick. Here's the behavior I'm seeing:

  1. cd ~/github/spell-check && apm link && apm install
  2. Open Atom and observe error: "Failed to activate the spell-check package"
  3. rm -rf ~/github/spell-check/node_modules/webworker-threads
  4. Reload Atom and observe that error no longer occurs

Since that seems to resolve the issue, is there a way that we can teach Atom (or the spell-check package) to not install the webworker-threads module?

One (super hacky) option might be to add a post-install hook on the spell-check package to delete the webworker-threads module. For example, imagine something like this, but tweaked to run in a cross-platform manner:

--- a/package.json
+++ b/package.json
@@ -84,5 +84,8 @@
         "^1.0.0": "consumeSpellCheckers"
       }
     }
+  },
+  "scripts": {
+    "postinstall": "rm -rf node_modules/webworker-threads"
   }
 }

@maxbrunsfeld
Copy link
Contributor

👍 Yeah that seems worth a try.

@dmoonfire
Copy link
Contributor

dmoonfire commented Apr 11, 2018

That is reasonable. Likewise, I can also work to get rid of natural from spelling-manager since I was just using it for easy tokenization.

@annthurium
Copy link

@jasonrudolph I am also able to reproduce it sometimes but not every time. I'll grab a stack trace next time I encounter it. is there any other debug output that would be helpful that I could try to capture?

@jasonrudolph
Copy link
Contributor

@maxbrunsfeld @dmoonfire: Thank you! I'll give this approach a shot in #244.

@annthurium: I can't think of any additional debug output to capture. If I think of any, I'll definitely let you know. 🙇

@jasonrudolph
Copy link
Contributor

The problem seen in #67 (comment) should be resolved by #246. That fix is included in Atom 1.26-beta2 (released today) and will be part of Atom 1.26 stable when it is released.

I'm going to close this issue. If you're using Atom 1.26-beta2 (or newer) and you continue to see this problem, please open a new issue to let us know.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants