Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Path must be a string. Received undefined #59

Open
OvermindDL1 opened this issue Jul 21, 2016 · 8 comments
Open

Uncaught TypeError: Path must be a string. Received undefined #59

OvermindDL1 opened this issue Jul 21, 2016 · 8 comments

Comments

@OvermindDL1
Copy link

  1. With atom running and linter-elm-make installed and running, open an elm file (in a project with no Main.elm as there are multiple main files) and run the atom command of Linter Elm Make: Set Main Paths, then select the path (I just put in one of the files for now for testing), got this:

Atom Version: 1.8.0
System: Microsoft Windows 10 Pro
Thrown From: linter-elm-make package, v0.12.2

Stack Trace

Uncaught TypeError: Path must be a string. Received undefined

At path.js:8

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:8:11)
    at Object.win32.join (path.js:221:5)
    at C:/Users/<username>/.atom/packages/linter-elm-make/lib/linter-elm-make.js:99:33
    at Function.module.exports.Emitter.simpleDispatch (C:\Users\<username>\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\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\event-kit\lib\emitter.js:125:28)
    at SetMainPathsView.confirm (C:/Users/<username>/.atom/packages/linter-elm-make/lib/set-main-paths-view.js:93:18)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\command-registry.js:260:29)
    at C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\window-event-handler.js:98:36)
    at HTMLDocument.<anonymous> (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\window-event-handler.js:3:61)

Commands

 17x -1:06.1.0 blur (atom-text-editor.editor.is-focused)
     -0:48.2.0 core:confirm (atom-text-editor.editor.mini.is-focused)
  3x -0:43.1.0 blur (atom-text-editor.editor.mini.is-focused)
     -0:30.1.0 core:save (input#linter-elm-make.lintOnTheFly.)
 18x -0:30 blur (input#linter-elm-make.lintOnTheFly.)
     -0:12.1.0 command-palette:toggle (atom-text-editor.editor.is-focused)
     -0:11.9.0 blur (atom-text-editor.editor.is-focused)
     -0:07.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -0:07.0 blur (atom-text-editor.editor.mini.is-focused)
     -0:07.0 linter-elm-make:set-main-paths (atom-text-editor.editor)
     -0:06.9.0 blur (atom-text-editor.editor)
     -0:01.8.0 linter-elm-make:confirm-set-main-paths (atom-text-editor.editor.atom-text-editor.linter-elm-make-set-main-paths.mini.is-focused)
     -0:01.7.0 blur (atom-text-editor.editor.atom-text-editor.linter-elm-make-set-main-paths.mini.is-focused)

Config

{
  "core": {
    "autoHideMenuBar": true,
    "disabledPackages": [
      "autocomplete-go",
      "atom-powersnap",
      "activate-power-mode-delete",
      "autocomplete-dcd",
      "elm",
      "autocomplete-en-en",
      "spell-check",
      "latex-completions",
      "erlang-build"
    ],
    "projectHome": "C:\\Users\\<username>\\Projects",
    "themes": [
      "atom-dark-ui",
      "solarized-dark-syntax"
    ]
  },
  "linter-elm-make": {
    "alwaysCompileMain": true,
    "elmMakeExecutablePath": "C:\\Program Files (x86)\\Elm Platform\\0.17.1\\bin\\elm-make.exe"
  }
}

Installed Packages

# User
activate-power-mode, v0.7.0
ascii-codes, v0.3.3
ascii-hex, v0.2.0
atom-autocomplete-erlang, v0.6.19
atom-beautify, v0.29.10
atom-elixir, v0.2.1
atom-formatter-jsbeautify, v1.1.2
atom-svg-icon-snippets, v0.3.3
atomic-chrome, v0.3.0
autocomplete-asciidoc, v0.1.1
autocomplete-awk, v0.1.2
autocomplete-cmake, v0.3.1
autocomplete-elixir, v1.5.14
autocomplete-emojis, v2.5.0
autocomplete-erlang, v1.1.2
autocomplete-fortran, v0.9.0
autocomplete-gdscript, v0.4.0
autocomplete-glsl, v0.2.3
autocomplete-html-entities, v0.1.0
autocomplete-js-import, v1.0.1
autocomplete-json, v5.1.0
autocomplete-mathjax, v0.1.1
autocomplete-modules, v1.5.2
autocomplete-oracle, v0.4.0
autocomplete-php, v0.3.7
autocomplete-python, v1.8.2
autocomplete-xml, v0.8.3
build-elixir, v0.6.0
build-powershell, v0.3.4
character-table, v0.4.3
clipboard-plus, v0.5.1
data-atom, v0.21.0
elixir-cmd, v0.2.9
elm-format, v2.0.1
elm-snippets, v0.1.0
emmet, v2.4.3
emoji-code, v0.3.1
erlang-autocompile, v0.1.1
es-identifier-highlight, v0.2.11
filesize, v0.4.2
fill-line, v1.0.0
fold-functions, v0.4.3
font-awesome-snippetset, v0.0.6
fonts, v1.6.0
git-checkout, v0.3.2
git-commit, v1.5.2
git-diff-details, v1.3.0
git-log, v0.4.1
go-config, v1.2.1
go-get, v1.0.3
hex, v0.6.2
highlight-bad-chars, v1.0.5
html-entitize, v1.1.0
language-asn1, v0.3.0
language-batchfile, v0.4.0
language-csv, v1.1.2
language-elixir, v0.14.0
language-elm, v1.5.0
language-elmx, v1.2.6
language-erlang, v3.0.0
language-javascript-jsx, v0.3.7
language-oracle, v1.4.1
language-pgsql, v0.2.3
language-powershell, v2.1.1
language-story, v1.2.0
language-svg, v0.9.0
linter, v1.11.14
linter-checkbashisms, v0.1.5
linter-elixir-credo, v1.1.0
linter-elm-make, v0.12.2
linter-erlang, v0.3.1
linter-erlang-dialyzer, v0.0.1
minimap, v4.24.7
minimap-bookmarks, v0.3.1
minimap-codeglance, v0.4.5
minimap-cursorline, v0.2.0
minimap-git-diff, v4.3.1
minimap-highlight-selected, v4.4.0
minimap-linter, v1.1.1
minimap-pigments, v0.2.1
minimap-selection, v4.4.0
open-no-binaries, v0.1.1
phoenix-elixir-snippets, v0.4.0
pigments, v0.31.2
project-colorize, v0.2.0
qolor, v0.2.2
react, v0.15.0
resize-indent, v0.3.0
svg-preview, v0.7.4
tabular, v0.1.0
text-manipulation, v0.6.0
tree-view-git-branch, v0.1.2
tree-view-git-status, v1.0.2

# Dev
No dev packages
@halohalospecial
Copy link
Collaborator

halohalospecial commented Jul 21, 2016

Hmm. What did you enter in the textbox? Was it relative to the location of elm-package.json or an absolute path? This will be tough for me to debug as I don't have a Windows 10 machine :(

As a temporary workaround, you can manually add this in your elm-package.json:

"linter-elm-make": {
    "mainPaths": [
      "Main.elm"
    ]
  }

@OvermindDL1
Copy link
Author

I left it as the default value that was already in the box (I had the tab open of one of the few main files), which was kind of like: web\elm\SomethingApp.elm

It did however add this itself to elm-package.json:

  "linter-elm-make": {
    "mainPaths": [
      "web\\elm\\SomethingApp.elm"
    ]
  }

@OvermindDL1
Copy link
Author

And yeah I am not a fan on this Win10 stuff, so many performance issues on it that my linux desktop at home just does not have, and this hardware is a lot more beefy than mine as well... >.>

@halohalospecial
Copy link
Collaborator

It's escaping the backslashes on save so "web\\elm\\SomethingApp.elm" is just fine.

I could not reproduce this on a Windows 7 machine :( Can you give me an idea on how your directory is structured? Like where is your elm-package.json relative to web\elm\SomethingApp.elm?

Or, even better if you can insert a console.log here (below line 98) so that we'll know the value of projectDirectory:

    this.setMainPathsView.onDidConfirm(({projectDirectory, mainPaths}) => {
      const jsonFilePath = path.join(projectDirectory, 'elm-package.json');
      let json = fs.readJsonSync(jsonFilePath, {throws: false});

Thanks!

@OvermindDL1
Copy link
Author

Certainly, can do!

The structure is:

.
./brunch-config.js
./package.json
./elm-package.json
./elm-stuff
./web/elm/MyApp.elm

I added a console.log("projectDirectory", projectDirectory) at line 99 (pushing line 99 to 100), restarted Atom, ran Set Main path, left it at "web/elm/MyApp.elm", same error occurred, and it printed this:

linter-elm-make.js:99 projectDirectory C:\Users\robertsong\Projects\ccc_server
linter-elm-make.js:99 projectDirectory undefined

There were none before, the two appeared with that run, so it ran it twice, hence why it saved the first time but not the next, unsure why running twice. Anything else I can check for you? :-)

@halohalospecial
Copy link
Collaborator

As far as I can recall, it's linting twice the first time because the text in the buffer changed (when it was loaded from file) and linter-elm-make is always forcing a lint whenever a buffer gets focused (when Lint On The Fly is enabled).

As for why it's undefined the 2nd lint, I have no idea right now 😕

@halohalospecial
Copy link
Collaborator

halohalospecial commented Jul 22, 2016

Can you try 0.13.2 and wait for the "Copied project files to work directory" notification to appear?

Thanks!

@OvermindDL1
Copy link
Author

Never did, got a message at the bottom of:

elm-make.exe: elm-lang-html-66b1583: MoveFileEx "elm-lang-html-66b1583" "elm-lang\\html\\1.1.0": permission denied (Access is denied.)at line 1 col 1 in web\elm\MessengerApp.elm

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

No branches or pull requests

2 participants