atom / tree-view

🌳 Explore and open project files in Atom
MIT License
561 stars 365 forks source link

Path must be a string. Received undefined #863

Closed Lartza closed 8 years ago

Lartza commented 8 years ago

Just opening Atom, since some time ago (at least in 1.7.4, probably before too) has resulted in the tree-view package failing to activate. Someone mentioned this happening for them on Arch too here #675 and I am using the prebuilt tensor5 packages with electron version 1.2.1

Atom Version: 1.8.0 System: "Arch Linux" Thrown From: tree-view package, v0.205.0

Stack Trace

Failed to activate the tree-view package

At Path must be a string. Received undefined

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.basename (path.js:1355:5)
    at Object.shouldAttach (/usr/lib/atom/node_modules/tree-view/lib/main.js:114:23)
    at Object.activate (/usr/lib/atom/node_modules/tree-view/lib/main.js:16:16)
    at Package.module.exports.Package.activateNow (/usr/lib/atom/src/package.js:183:20)
    at /usr/lib/atom/src/package.js:156:32
    at Package.module.exports.Package.measure (/usr/lib/atom/src/package.js:92:15)
    at /usr/lib/atom/src/package.js:149:26
    at Package.module.exports.Package.activate (/usr/lib/atom/src/package.js:146:34)
    at PackageManager.module.exports.PackageManager.activatePackage (/usr/lib/atom/src/package-manager.js:530:21)
    at /usr/lib/atom/src/package-manager.js:511:29
    at Config.module.exports.Config.transactAsync (/usr/lib/atom/src/config.js:337:18)
    at PackageManager.module.exports.PackageManager.activatePackages (/usr/lib/atom/src/package-manager.js:506:19)
    at PackageManager.module.exports.PackageManager.activate (/usr/lib/atom/src/package-manager.js:489:46)
    at /usr/lib/atom/src/atom-environment.js:754:28

Commands

Config

{
  "core": {
    "allowPendingPaneItems": false,
    "automaticallyUpdate": false,
    "openEmptyEditorOnStart": false
  }
}

Installed Packages

# User
file-icons, v1.7.13
minimap, v4.24.3
minimap-autohide, v0.10.1

# Dev
No dev packages
tensor5 commented 8 years ago

This problem happens when using Atom with the Electron 1.2, which is based on Node 6. After this commit, path.basename() only accept strings as input.

Steps to reproduce:

$ rm ~/.atom/storage/application.json
$ atom

Solution:

https://github.com/atom/tree-view/blob/e93c939bec8aad681df77f308479cb57a314aa0c/lib/main.coffee#L54 should not allowed to be undefined. When undefined it should be '.' instead. I can open a pull request if needed.

alex94cp commented 8 years ago

Same issue is present also in Fedora 24, mosquito/atom copr

lee-dohm commented 8 years ago

If this is caused by building Atom in an unsupported way, like on top of a version of Electron that we don't package for Atom yet, then I'm going to have to close this as wontfix. Please let me know if this is the case.

lee-dohm commented 8 years ago

So far we've seen this only in versions of Atom that have been built with unsupported versions of Electron, such as the mostquito/atom copr. If you can reproduce this error in a supported build of Atom, please supply repro steps along with the output of atom --version and we'll reopen the Issue.

alex94cp commented 8 years ago

So that you know, as of v1.8.0 this issue is no longer present in the mosquito/atom copr

yajo commented 8 years ago

Actually I just got hit by this with mosquito/atom when opening config folder from the settings tab. @1dot75cm

tensor5 commented 8 years ago

@Yajo Is mosquito/atom using this patch?

IamAdamJowett commented 8 years ago

I am now getting this same error on Windows 10, Atom v1.8.0, cannot manually install and activate (for some reason the tree view disappeared this morning)

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.8.0 System: Microsoft Windows 10 Home Thrown From: tree-view package, v0.208.0

Stack Trace

Failed to activate the tree-view package

At Cannot find module 'event-kit'

Error: Cannot find module 'event-kit'
    at Module._resolveFilename (module.js:338:15)
    at Function.Module._resolveFilename (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\module-cache.js:383:52)
    at Function.Module._load (module.js:289:25)
    at Module.require (module.js:366:17)
    at require (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\native-compile-cache.js:50:27)
    at Object.<anonymous> (file:///C:/Users/Adam/.atom/packages/tree-view/lib/main.coffee:1:25)
    at Object.<anonymous> (file:///C:/Users/Adam/.atom/packages/tree-view/lib/main.coffee:1:1)
    at Module._compile (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\native-compile-cache.js:103:30)
    at Object.defineProperty.value [as .coffee] (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\compile-cache.js:208:21)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\native-compile-cache.js:50:27)
    at Package.module.exports.Package.requireMainModule (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\package.js:715:27)
    at Package.module.exports.Package.activateNow (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\package.js:173:16)
    at C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\package.js:156:32
    at Package.module.exports.Package.measure (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\package.js:92:15)
    at C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\package.js:149:26
    at Package.module.exports.Package.activate (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\package.js:146:34)
    at PackageManager.module.exports.PackageManager.activatePackage (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\package-manager.js:538:21)
    at C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\package-manager.js:342:19
    at C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\config.js:631:20
    at Function.module.exports.Emitter.simpleDispatch (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\event-kit\lib\emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\event-kit\lib\emitter.js:125:28)
    at Config.module.exports.Config.emitChangeEvent (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\config.js:816:29)
    at Config.module.exports.Config.setRawValue (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\config.js:608:19)
    at Config.module.exports.Config.set (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\config.js:227:14)
    at Config.module.exports.Config.removeAtKeyPath (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\config.js:377:12)
    at Package.module.exports.Package.enable (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\package.js:77:26)
    at PackageManager.module.exports.PackageManager.enablePackage (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\src\package-manager.js:169:14)
    at HTMLButtonElement.<anonymous> (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\settings-view\lib\package-card.js:328:27)
    at HTMLButtonElement.jQuery.event.dispatch (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\jquery\dist\jquery.js:4435:9)
    at HTMLButtonElement.elemData.handle (C:\Users\Adam\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\jquery\dist\jquery.js:4121:28)

Commands

Config

{
  "core": {
    "autoHideMenuBar": true,
    "excludeVcsIgnoredPaths": true,
    "ignoredNames": [
      ".git",
      ".hg",
      ".svn",
      ".DS_Store",
      "._*",
      "Thumbs.db",
      ".unison",
      "CVS",
      ".AppleDouble",
      ".LSOverride",
      ".Spotlight-V100",
      ".Trashes",
      "desktop.ini",
      "*.lock",
      "*.sock",
      "*.pid",
      "*.sw?",
      ".unison*",
      "*~"
    ],
    "projectHome": "C:\\Users\\Adam\\dev",
    "themes": [
      "atom-dark-ui",
      "one-dark-syntax"
    ]
  },
  "tree-view": {
    "hideIgnoredNames": true
  }
}

Installed Packages

# User
aligner, v0.22.0
angularjs, v0.3.4
autocomplete-modules, v1.5.1
autocomplete-php, v0.3.7
docblockr, v0.7.3
emmet, v2.4.3
file-icons, v1.7.14
jshint, v1.8.5
language-asp, v1.0.0
linter, v1.11.10
linter-csslint, v1.3.2
linter-jsonlint, v1.2.5
linter-less, v2.5.0
linter-php, v1.2.0
merge-conflicts, v1.4.4
minimap, v4.24.4
package-sync, v1.1.0
pigments, v0.29.2
project-manager, v2.9.7
sync-settings, v0.7.2
tabasco, v0.5.0
terminal-panel, v1.14.1
tool-bar, v0.4.0
tree-view, v0.208.0
tree-view-git-status, v1.0.0

# Dev
No dev packages
yajo commented 8 years ago

@tensor5 All I know is it's Atom 1.8.0. Not sure what patches it has. Its info is in https://copr.fedorainfracloud.org/coprs/mosquito/atom/.

@1dot75cm can help more here.

therocco commented 8 years ago

I get this error on a brand new install of Atom v1.8.0 on Ubuntu 16.04 with no plugins installed.

juba commented 8 years ago

@nerdofsteel Reinstall Atom following the instructions here : https://github.com/atom/atom/issues/12182

This fixed the problem for me on Ubuntu 16.04.

djfm commented 8 years ago

@juba Same issue, fix worked for me too. That's a bit strange. Apparently installing atom 1.8 with dpkg when atom 1.8 is already installed messes things up :)

yajo commented 8 years ago

I finally got it working: https://github.com/atom/settings-view/issues/766#issuecomment-233382832