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

Second Run Of Elm-Analyse is broken #132

Closed
gogocurtis opened this issue Dec 14, 2017 · 7 comments
Closed

Second Run Of Elm-Analyse is broken #132

gogocurtis opened this issue Dec 14, 2017 · 7 comments
Labels
Milestone

Comments

@gogocurtis
Copy link

Second run of [email protected] results in the following crash

undefined:1
Processing multiple files...
^

SyntaxError: Unexpected token P in JSON at position 0
    at JSON.parse (<anonymous>)
    at setupCache (/usr/local/lib/node_modules/elm-analyse/js/util/format-service.js:49:39)

in my case I have patched format service

        } catch (e) {
            // Parse Std [1]
             try {
            const invalidFiles = JSON.parse(e.output[1].toString());
            invalidFiles.forEach(f => {
                cache[f.path] = false;
            });
             } catch (ej) {
                console.log(e.output[1].toString())

                }
        }

in my case e.output[1].toString() is not json.

It is:
File would be changed /Users/curtis/Dev/elm-spike/elm-stuff/.elm-analyse/_shas/099b1e4d7d73a905e2c0b7ff47a32edb3734c3ef.elma

@stil4m
Copy link
Owner

stil4m commented Dec 15, 2017

Thanks for your report. Much appreciated.

Which version of elm-format are you using?

I believe 0.6 and up supports JSON output when a path is validated. elm-analyse uses that JSON output. If you are using 0.5 at the moment that would explain the issue. Still, this needs to be fixed.

@stil4m stil4m added the bug label Dec 15, 2017
@jarcane
Copy link

jarcane commented Dec 22, 2017

Having the same bug. Elm-analyse 0.13.2, elm-format-0.18 0.6.1-alpha.

It was working in CLI mode on a previous version, but the -s server mode would crash with a different bug, so I updated it and now it does this on both:

Fetching package information from package.elm-lang.org.
Fetched dependencies
undefined:1
[There was a problem reading one or more of the specified input files:
 ^

SyntaxError: Unexpected token T in JSON at position 1
    at JSON.parse (<anonymous>)
    at setupCache (C:\Users\<redacted>\AppData\Roaming\npm\node_modules\elm-analyse\js\util\format-service.js:48:39)
    at module.exports (C:\Users\<redacted>\AppData\Roaming\npm\node_modules\elm-analyse\js\util\format-service.js:56:5)
    at module.exports (C:\Users\<redacted>\AppData\Roaming\npm\node_modules\elm-analyse\js\fileReader.js:8:59)
    at module.exports (C:\Users\<redacted>\AppData\Roaming\npm\node_modules\elm-analyse\js\util\file-loading-ports.js:8:48)
    at C:\Users\<redacted>\AppData\Roaming\npm\node_modules\elm-analyse\js\analyser.js:22:9
    at C:\Users\<redacted>\AppData\Roaming\npm\node_modules\elm-analyse\js\util\dependencies.js:34:9
    at Request._callback (C:\Users\<redacted>\AppData\Roaming\npm\node_modules\elm-analyse\js\util\dependencies.js:19:9)
    at Request.self.callback (C:\Users\<redacted>\AppData\Roaming\npm\node_modules\elm-analyse\node_modules\request\request.js:186:22)
    at emitTwo (events.js:125:13)

@stil4m
Copy link
Owner

stil4m commented Dec 22, 2017

Found the issue and fixed it. Will release it later today in 0.13.3. Thanks for your bug report!

@stil4m stil4m closed this as completed Dec 22, 2017
@jarcane
Copy link

jarcane commented Dec 27, 2017

Thanks. I still get the same error but it runs now. I'm also getting an error with the server mode complaining that "./tests is missing" but I just made an empty directory and that went away.

@stil4m
Copy link
Owner

stil4m commented Dec 27, 2017

@jarcane. Hi Jarcane. Great that is working now. Can you create an issue for the error you encountered? Could you provide the (anonymised) elm-package.json and the folder structure (CLI ls or dir) that allows me to reproduce the issue? Thanks.

@jarcane
Copy link

jarcane commented Dec 28, 2017

Sure, I'll take a look and see what I can do next week.

@jarcane
Copy link

jarcane commented Jan 8, 2018

After looking at my elm-package, I think actually the error was because of an extra dir in my config and not elm-analyse' fault.

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

No branches or pull requests

3 participants