Open MathijsvVelde opened 8 years ago
+1
+1 seeing this also in Atom editor v1.4.1 and Mac OS X 10.11.3 El Capitan.
Failed to activate the node-resolver package
Cannot read property 'command' of undefined
Hide Stack Trace
TypeError: Cannot read property 'command' of undefined
at Object.exports.activate (/Users/yuetsu/.atom/packages/node-resolver/index.js:12:21)
at Package.module.exports.Package.activateNow (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:183:20)
at /Applications/Atom.app/Contents/Resources/app.asar/src/package.js:156:32
at Package.module.exports.Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:92:15)
at /Applications/Atom.app/Contents/Resources/app.asar/src/package.js:149:26
at Package.module.exports.Package.activate (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:146:34)
at PackageManager.module.exports.PackageManager.activatePackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:524:21)
at /Applications/Atom.app/Contents/Resources/app.asar/node_modules/settings-view/lib/package-manager.js:444:29
at exit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/settings-view/lib/package-manager.js:73:16)
at triggerExitCallback (/Applications/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:213:47)
at /Applications/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:220:18
at Socket.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:98:18)
at emitOne (events.js:82:20)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:469:12)
The error was thrown from the node-resolver package. You can help by creating an issue. Please explain what actions triggered this error.
best,
— faddah
portland, oregon, u.s.a.
+1 Reproduced on Linux Mint 17.2, atom 1.4.3.
Looks like this is the root of the issue:
https://discuss.atom.io/t/replacement-for-atom-workspaceview-command/13636
+1
+1
+1
+1
+1
+1 (Atom 1.6, Ubuntu)
@MathijsvVelde @leothelocust @faddah @invernizzie @VijayKumarMidde
too lazy to open a PR... but here is the fixed index.js
file.. works on Mac Atom 1.7.2
var isRequire = require('is-require')('require')
var core = require('resolve/lib/core.json')
var position = require('file-position')
var eval = require('static-eval')
var esprima = require('esprima')
var resolve = require('resolve')
var clone = require('clone')
var path = require('path')
var astw = require('astw')
exports.activate = function() {
atom.commands.add('atom-workspace','node-resolver:open-selected-dependencies', function() {
var editor = atom.workspace.getActiveTextEditor()
var ranges = editor.getSelectedBufferRanges().slice()
var buffer = editor.getBuffer()
var fpn = editor.getPath()
var src = buffer.getText()
var ast = esprima.parse(src, {
loc: true
})
var lookup = position(src)
var dir = path.dirname(fpn)
var env = {}
env.__dirname = dir
env.__filename = fpn
astw(ast)(function(node) {
if (!isRequire(node)) return
if (!node.arguments) return
if (!node.arguments.length) return
var dst = node.evalled = node.evalled || eval(node.arguments[0], env)
if (!dst) return
if (core.indexOf(dst) !== -1) return
var included = false
for (var i = 0; i < ranges.length; i++) {
var loc = clone(node.loc)
loc.start.line--
loc.end.line--
var a = getIndex(lookup, ranges[i])
var b = getIndex(lookup, loc)
if (included = overlap(a, b)) break
}
if (!included) return
resolve(dst, {
basedir: dir
}, function(err, result) {
if (err) throw err
return atom.workspace.open(result)
})
})
})
}
function overlap(a, b) {
if (a.end >= b.start && a.start <= b.start) return true
if (b.end >= a.start && b.start <= a.start) return true
if (a.start <= b.start && a.end >= b.end) return true
if (b.start <= a.start && b.end >= a.end) return true
}
function getIndex(lookup, range, off) {
off = off || 0
return {
start: lookup((range.start.row || range.start.line) + off, range.start.column)
, end: lookup((range.end.row || range.end.line) + off, range.end.column)
}
}
Same problem for me:
Atom Version: 1.8.0 System: Ubuntu 15.04 Thrown From: node-resolver package, v1.0.1
Failed to activate the node-resolver package
At Cannot read property 'command' of undefined
TypeError: Cannot read property 'command' of undefined
at Object.exports.activate (/home/sergio/.atom/packages/node-resolver/index.js:12:21)
at Package.module.exports.Package.activateNow (/usr/share/atom/resources/app.asar/src/package.js:183:20)
at /usr/share/atom/resources/app.asar/src/package.js:156:32
at Package.module.exports.Package.measure (/usr/share/atom/resources/app.asar/src/package.js:92:15)
at /usr/share/atom/resources/app.asar/src/package.js:149:26
at Package.module.exports.Package.activate (/usr/share/atom/resources/app.asar/src/package.js:146:34)
at PackageManager.module.exports.PackageManager.activatePackage (/usr/share/atom/resources/app.asar/src/package-manager.js:538:21)
at /usr/share/atom/resources/app.asar/src/package-manager.js:519:29
at Config.module.exports.Config.transactAsync (/usr/share/atom/resources/app.asar/src/config.js:337:18)
at PackageManager.module.exports.PackageManager.activatePackages (/usr/share/atom/resources/app.asar/src/package-manager.js:514:19)
at PackageManager.module.exports.PackageManager.activate (/usr/share/atom/resources/app.asar/src/package-manager.js:497:46)
at /usr/share/atom/resources/app.asar/src/atom-environment.js:754:28
{
"core": {
"projectHome": "/home/sergio/dev/Mettzer"
}
}
# User
atom-react-native-autocomplete, v0.0.27
color-picker, v2.2.1
css-comb, v2.4.3
javascript-snippets, v1.2.1
jshint, v1.8.5
language-javascript-jsx, v0.3.7
linter, v1.11.14
linter-csslint, v1.3.2
merge-conflicts, v1.4.4
node-debugger, v1.7.0
node-resolver, v1.0.1
react, v0.15.0
react-es6-snippets, v0.3.0
react-snippets, v0.4.2
terminal-plus, v0.14.5
# Dev
No dev packages
Same issue:
Atom Version: 1.10.2 Electron Version: 0.37.8 System: Mac OS X 10.11.6 Thrown From: node-resolver package, v1.0.1
Failed to activate the node-resolver package
At Cannot read property 'command' of undefined
TypeError: Cannot read property 'command' of undefined
at Object.exports.activate (/Users/hannah/.atom/packages/node-resolver/index.js:12:21)
at Package.module.exports.Package.activateNow (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:183:20)
at /Applications/Atom.app/Contents/Resources/app.asar/src/package.js:156:32
at Package.module.exports.Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:92:15)
at /Applications/Atom.app/Contents/Resources/app.asar/src/package.js:149:26
at Package.module.exports.Package.activate (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:146:34)
at PackageManager.module.exports.PackageManager.activatePackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:538:21)
at /Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:519:29
at Config.module.exports.Config.transactAsync (/Applications/Atom.app/Contents/Resources/app.asar/src/config.js:337:18)
at PackageManager.module.exports.PackageManager.activatePackages (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:514:19)
at PackageManager.module.exports.PackageManager.activate (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:497:46)
at /Applications/Atom.app/Contents/Resources/app.asar/src/atom-environment.js:765:28
{
"core": {
"automaticallyUpdate": false,
"disabledPackages": [
"language-sass",
"language-ruby",
"language-ruby-on-rails",
"language-python",
"language-php",
"language-perl",
"language-less",
"language-c",
"language-clojure",
"language-coffee-script",
"language-csharp",
"language-go",
"language-java",
"language-objective-c",
"language-toml"
],
"themes": [
"one-dark-ui",
"solarized-light-syntax"
]
}
}
# User
atom-handlebars, v1.3.0 (inactive)
atom-ternjs, v0.15.0 (inactive)
autocomplete-modules, v1.6.3 (inactive)
autocomplete-paths, v1.0.2 (inactive)
docblockr, v0.8.5 (inactive)
editorconfig, v1.4.1 (inactive)
git-blame, v0.4.11 (inactive)
git-plus, v5.17.1 (inactive)
git-projects, v1.17.0 (inactive)
highlight-selected, v0.11.2 (inactive)
maybs-quit, v1.3.0 (inactive)
node-resolver, v1.0.1 (inactive)
pigments, v0.35.1 (inactive)
solarized-seti-ui, v0.8.6 (inactive)
todo-show, v1.7.0 (inactive)
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.44.0 (inactive)
base16-tomorrow-dark-theme, v1.1.0 (inactive)
base16-tomorrow-light-theme, v1.1.1 (inactive)
one-dark-ui, v1.5.0 (inactive)
one-light-ui, v1.5.0 (inactive)
one-dark-syntax, v1.3.0 (inactive)
one-light-syntax, v1.3.0 (inactive)
solarized-dark-syntax, v1.0.2 (inactive)
solarized-light-syntax, v1.0.2 (inactive)
about, v1.5.3 (inactive)
archive-view, v0.61.1 (inactive)
autocomplete-atom-api, v0.10.0 (inactive)
autocomplete-css, v0.11.2 (inactive)
autocomplete-html, v0.7.2 (inactive)
autocomplete-plus, v2.31.1 (inactive)
autocomplete-snippets, v1.11.0 (inactive)
autoflow, v0.27.0 (inactive)
autosave, v0.23.1 (inactive)
background-tips, v0.26.1 (inactive)
bookmarks, v0.41.0 (inactive)
bracket-matcher, v0.82.1 (inactive)
command-palette, v0.38.0 (inactive)
deprecation-cop, v0.54.1 (inactive)
dev-live-reload, v0.47.0 (inactive)
encoding-selector, v0.22.0 (inactive)
exception-reporting, v0.39.0 (inactive)
find-and-replace, v0.201.0 (inactive)
fuzzy-finder, v1.3.0 (inactive)
git-diff, v1.1.0 (inactive)
go-to-line, v0.31.0 (inactive)
grammar-selector, v0.48.1 (inactive)
image-view, v0.58.2 (inactive)
incompatible-packages, v0.26.1 (inactive)
keybinding-resolver, v0.35.0 (inactive)
line-ending-selector, v0.5.0 (inactive)
link, v0.31.1 (inactive)
markdown-preview, v0.158.0 (inactive)
metrics, v0.53.1 (inactive)
notifications, v0.65.0 (inactive)
open-on-github, v1.2.0 (inactive)
package-generator, v1.0.0 (inactive)
settings-view, v0.242.2 (inactive)
snippets, v1.0.2 (inactive)
spell-check, v0.67.1 (inactive)
status-bar, v1.4.1 (inactive)
styleguide, v0.47.0 (inactive)
symbols-view, v0.113.0 (inactive)
tabs, v0.100.2 (inactive)
timecop, v0.33.2 (inactive)
tree-view, v0.208.2 (inactive)
update-package-dependencies, v0.10.0 (inactive)
welcome, v0.34.0 (inactive)
whitespace, v0.33.0 (inactive)
wrap-guide, v0.38.1 (inactive)
language-c, v0.52.1 (inactive)
language-clojure, v0.21.0 (inactive)
language-coffee-script, v0.47.2 (inactive)
language-csharp, v0.12.1 (inactive)
language-css, v0.37.1 (inactive)
language-gfm, v0.88.0 (inactive)
language-git, v0.15.0 (inactive)
language-go, v0.42.1 (inactive)
language-html, v0.45.1 (inactive)
language-hyperlink, v0.16.0 (inactive)
language-java, v0.23.0 (inactive)
language-javascript, v0.119.0 (inactive)
language-json, v0.18.2 (inactive)
language-less, v0.29.5 (inactive)
language-make, v0.22.2 (inactive)
language-mustache, v0.13.0 (inactive)
language-objective-c, v0.15.1 (inactive)
language-perl, v0.35.0 (inactive)
language-php, v0.37.2 (inactive)
language-property-list, v0.8.0 (inactive)
language-python, v0.45.0 (inactive)
language-ruby, v0.69.0 (inactive)
language-ruby-on-rails, v0.25.0 (inactive)
language-sass, v0.56.0 (inactive)
language-shellscript, v0.22.4 (inactive)
language-source, v0.9.0 (inactive)
language-sql, v0.23.0 (inactive)
language-text, v0.7.1 (inactive)
language-todo, v0.28.0 (inactive)
language-toml, v0.18.0 (inactive)
language-xml, v0.34.9 (inactive)
language-yaml, v0.26.0 (inactive)
# Dev
No dev packages
+2
this could be fixed with PR #16
I just installed "node-resolver" into "ATOM" and and on activation it threw an error... :cry:
Atom Version: 1.4.1 System: Mac OS X 10.11.3 Thrown From: node-resolver package, v1.0.1
Stack Trace
Failed to activate the node-resolver package
Commands
Config
Installed Packages