# Can not get elm-analyse and elm-language-server work

**URL:** <https://discourse.elm-lang.org/t/can-not-get-elm-analyse-and-elm-language-server-work/4508>\
**Category:** Learn\
**Created:** [October 19, 2019, 8:06pm UTC](https://discourse.elm-lang.org/t/can-not-get-elm-analyse-and-elm-language-server-work/4508 "2019-10-19T20:06:45Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![AkhIL](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/akhil/32/2602_2.png) [@AkhIL](https://discourse.elm-lang.org/u/AkhIL)\
**Post date:** [October 19, 2019, 8:06pm UTC](https://discourse.elm-lang.org/t/can-not-get-elm-analyse-and-elm-language-server-work/4508/1 "2019-10-19T20:06:45Z")

</div>

I have a project with the code from Elm’s tutorial.  
Page itself works great, elm-format also works well. But elm-language-server and elm-analyse fails with same error:

```
`--> elm-analyse src/Main.elm
Fetching package information from package.elm-lang.org.
Fetched dependencies
INFO: Started...
INFO: No configuration provided. Using default configuration.
INFO: Load dependency elm/browser 1.0.1
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '/home/ildar/Projects/learning-elm/test/elm-stuff/packages/elm/browser/1.0.1/elm.json'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.getDependencyFiles (/home/ildar/.config/yarn/global/node_modules/elm-analyse/dist/app/util/file-gatherer.js:63:26)
    at Array.<anonymous> (/home/ildar/.config/yarn/global/node_modules/elm-analyse/dist/app/ports/dependency-files.js:13:35)
    at Function.f (/home/ildar/.config/yarn/global/node_modules/elm-analyse/dist/app/backend-elm.js:2170:19)
    at A3 (/home/ildar/.config/yarn/global/node_modules/elm-analyse/dist/app/backend-elm.js:59:28)
    at Object.b (/home/ildar/.config/yarn/global/node_modules/elm-analyse/dist/app/backend-elm.js:1974:7)
    at _Scheduler_step (/home/ildar/.config/yarn/global/node_modules/elm-analyse/dist/app/backend-elm.js:1818:20)

```

As I figured out all modules located in local cache inside ~/elm directory. How I can make elm-analyse and elm-language-server load modules form local cache?

Environment:  
installed globally with yarn

- elm@0.19.0-no-deps
- @elm-tooling/elm-language-server@1.4.1
- elm-analyse@0.16.4
- elm-format@0.8.2  
installed with system package manager
- node v10.16.3

---

<div class="post-metadata">

**Author:** ![razze](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/razze/32/1650_2.png) [@razze](https://discourse.elm-lang.org/u/razze)\
**Post date:** [October 21, 2019, 11:25am UTC](https://discourse.elm-lang.org/t/can-not-get-elm-analyse-and-elm-language-server-work/4508/2 "2019-10-21T11:25:06Z")

</div>

I think this turned out to bo a problem with elm-analyse? [https://github.com/elm-tooling/elm-language-server/issues/176](https://github.com/elm-tooling/elm-language-server/issues/176)

---

<div class="post-metadata">

**Author:** ![AkhIL](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/akhil/32/2602_2.png) [@AkhIL](https://discourse.elm-lang.org/u/AkhIL)\
**Post date:** [October 21, 2019, 11:53am UTC](https://discourse.elm-lang.org/t/can-not-get-elm-analyse-and-elm-language-server-work/4508/3 "2019-10-21T11:53:18Z")

</div>

Here is [my bug report against elm-analyse](https://github.com/stil4m/elm-analyse/issues/218).

I looked through the [file-gather.ts](https://github.com/stil4m/elm-analyse/blob/master/ts/util/file-gatherer.ts) and did not saw any mention of a local cache. It tries to load modules only from the project/elm-stuff/ directory.

---

<div class="post-metadata">

**Author:** ![razze](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/razze/32/1650_2.png) [@razze](https://discourse.elm-lang.org/u/razze)\
**Post date:** [October 21, 2019, 12:43pm UTC](https://discourse.elm-lang.org/t/can-not-get-elm-analyse-and-elm-language-server-work/4508/4 "2019-10-21T12:43:19Z")

</div>

Can you try if you hit the same problem with the vscode extension? [https://marketplace.visualstudio.com/items?itemName=Elmtooling.elm-ls-vscode](https://marketplace.visualstudio.com/items?itemName=Elmtooling.elm-ls-vscode)

---

<div class="post-metadata">

**Author:** ![AkhIL](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/akhil/32/2602_2.png) [@AkhIL](https://discourse.elm-lang.org/u/AkhIL)\
**Post date:** [October 21, 2019, 2:00pm UTC](https://discourse.elm-lang.org/t/can-not-get-elm-analyse-and-elm-language-server-work/4508/5 "2019-10-21T14:00:49Z")

</div>

I do not really know how to use the VSCode, I installed extension over VSCode and still have no auto-completion and syntax check. All tools: elm-analyse, elm-test, elm-format, elm-language-server and elm itself accessible with the PATH environment variable.

VSCode installed from flathub. JavaScript and Python extensions from Mircrosof works well.

---

<div class="post-metadata">

**Author:** ![razze](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/razze/32/1650_2.png) [@razze](https://discourse.elm-lang.org/u/razze)\
**Post date:** [October 21, 2019, 2:21pm UTC](https://discourse.elm-lang.org/t/can-not-get-elm-analyse-and-elm-language-server-work/4508/6 "2019-10-21T14:21:36Z")

</div>

This should outline all you need to do

> **[elm-tooling/elm-language-client-vscode](https://github.com/elm-tooling/elm-language-client-vscode#install)**
>
> Improving your Elm experience since 2019. Contribute to elm-tooling/elm-language-client-vscode development by creating an account on GitHub.

Please also make sure that you have a valid `elm.json` that actually points to your `.elm` files

---

<div class="post-metadata">

**Author:** ![AkhIL](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/akhil/32/2602_2.png) [@AkhIL](https://discourse.elm-lang.org/u/AkhIL)\
**Post date:** [October 21, 2019, 3:07pm UTC](https://discourse.elm-lang.org/t/can-not-get-elm-analyse-and-elm-language-server-work/4508/7 "2019-10-21T15:07:39Z")

</div>

Got it work. I should use “File-\>Open Folder” instead of “File-\>Open File”.

I wrote one example from the elm tutorial and auto-completions still works.  
Same code with the nvim makes the language server fail.

---

<div class="post-metadata">

**Author:** ![andys8](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/andys8/32/280_2.png) [@andys8](https://discourse.elm-lang.org/u/andys8)\
**Post date:** [October 21, 2019, 9:07pm UTC](https://discourse.elm-lang.org/t/can-not-get-elm-analyse-and-elm-language-server-work/4508/8 "2019-10-21T21:07:25Z")

</div>

Great you got it to work by changing working directory.

I think it might be improved in the future [with better error messages](https://github.com/elm-tooling/elm-language-server/issues/167) or search for `elm.json` could be recursive upwards the directory structure (probably error prone by itself).

---

<div class="post-metadata">

**Author:** ![AkhIL](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/akhil/32/2602_2.png) [@AkhIL](https://discourse.elm-lang.org/u/AkhIL)\
**Post date:** [October 22, 2019, 1:36am UTC](https://discourse.elm-lang.org/t/can-not-get-elm-analyse-and-elm-language-server-work/4508/9 "2019-10-22T01:36:12Z")

</div>

Yes the VSCode plugin works. But console elm-analyse and elm-language-server with language-server-neovim still doesn’t.

Also elm-analyse outputs `There is no elm.json file in this directory. elm-analyse will only work in directories where such a file is located.` if I call it from non project directory.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [November 1, 2019, 1:36am UTC](https://discourse.elm-lang.org/t/can-not-get-elm-analyse-and-elm-language-server-work/4508/10 "2019-11-01T01:36:12Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
