How to ignore compilation warnings when running phoenix server












1














I'm trying to run phoenix server from the command line with iex -S mix phx.server but I keep getting warnings on compilation about unused variables.



Compilation failed due to warnings while using the --warnings-as-errors option



I don't care about these warnings as i am in the middle of development and these vars will eventually be used or tossed out. I have tried passing -h and other sensible options, but none of them work and I can't find anything in the docs about how to get phx.server to pass or override options to the compiler.



I've seen these docs and they haven't helped




  • https://hexdocs.pm/mix/Mix.Tasks.Run.html

  • https://hexdocs.pm/phoenix/Mix.Tasks.Phx.Server.html


I have tried passing the --no-compile option but this is a no-go since it leaves me unable to recompile during development. I am currently using IO.inspect to call the vars and this seems to be "good enough" for me to pass the unused vars check, but I would rather be able to disable this flag in the compiler rather than littering my code with IO.inspect










share|improve this question





























    1














    I'm trying to run phoenix server from the command line with iex -S mix phx.server but I keep getting warnings on compilation about unused variables.



    Compilation failed due to warnings while using the --warnings-as-errors option



    I don't care about these warnings as i am in the middle of development and these vars will eventually be used or tossed out. I have tried passing -h and other sensible options, but none of them work and I can't find anything in the docs about how to get phx.server to pass or override options to the compiler.



    I've seen these docs and they haven't helped




    • https://hexdocs.pm/mix/Mix.Tasks.Run.html

    • https://hexdocs.pm/phoenix/Mix.Tasks.Phx.Server.html


    I have tried passing the --no-compile option but this is a no-go since it leaves me unable to recompile during development. I am currently using IO.inspect to call the vars and this seems to be "good enough" for me to pass the unused vars check, but I would rather be able to disable this flag in the compiler rather than littering my code with IO.inspect










    share|improve this question



























      1












      1








      1







      I'm trying to run phoenix server from the command line with iex -S mix phx.server but I keep getting warnings on compilation about unused variables.



      Compilation failed due to warnings while using the --warnings-as-errors option



      I don't care about these warnings as i am in the middle of development and these vars will eventually be used or tossed out. I have tried passing -h and other sensible options, but none of them work and I can't find anything in the docs about how to get phx.server to pass or override options to the compiler.



      I've seen these docs and they haven't helped




      • https://hexdocs.pm/mix/Mix.Tasks.Run.html

      • https://hexdocs.pm/phoenix/Mix.Tasks.Phx.Server.html


      I have tried passing the --no-compile option but this is a no-go since it leaves me unable to recompile during development. I am currently using IO.inspect to call the vars and this seems to be "good enough" for me to pass the unused vars check, but I would rather be able to disable this flag in the compiler rather than littering my code with IO.inspect










      share|improve this question















      I'm trying to run phoenix server from the command line with iex -S mix phx.server but I keep getting warnings on compilation about unused variables.



      Compilation failed due to warnings while using the --warnings-as-errors option



      I don't care about these warnings as i am in the middle of development and these vars will eventually be used or tossed out. I have tried passing -h and other sensible options, but none of them work and I can't find anything in the docs about how to get phx.server to pass or override options to the compiler.



      I've seen these docs and they haven't helped




      • https://hexdocs.pm/mix/Mix.Tasks.Run.html

      • https://hexdocs.pm/phoenix/Mix.Tasks.Phx.Server.html


      I have tried passing the --no-compile option but this is a no-go since it leaves me unable to recompile during development. I am currently using IO.inspect to call the vars and this seems to be "good enough" for me to pass the unused vars check, but I would rather be able to disable this flag in the compiler rather than littering my code with IO.inspect







      elixir phoenix-framework






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 19 '18 at 18:56







      Ben Glasser

















      asked Nov 19 '18 at 18:46









      Ben GlasserBen Glasser

      1,86611932




      1,86611932
























          1 Answer
          1






          active

          oldest

          votes


















          4














          The error message is pretty clear on that:




          Compilation failed due to warnings while using the --warnings-as-errors option




          You have this specific flag enabled on the compiler, it returns a non-zero exit code on warnings. Since you're not passing the option manually in the command-line, it's possible that it's being:




          • Set via an ENV variable (possibly by an Elixir version manager)

          • Being passed in a mix alias or task


          • But most probably it's hardcoded in your Mixfile under elixirc_options. You can disable it like this:



            # mix.exs
            elixirc_options: [warnings_as_errors: false]





          On a side note, to get help on compiler options, you should use elixirc:



          ± % elixirc --help
          Usage: elixirc [elixir switches] [compiler switches] [.ex files]

          -o The directory to output compiled files

          --help, -h Prints this message and exits
          --ignore-module-conflict Does not emit warnings if a module was previously defined
          --no-debug-info Does not attach debug info to compiled modules
          --no-docs Does not attach documentation to compiled modules
          --verbose Prints compilation status
          --version, -v Prints Elixir version and exits
          --warnings-as-errors Treats warnings as errors and return non-zero exit code

          ** Options given after -- are passed down to the executed code
          ** Options can be passed to the Erlang runtime using ELIXIR_ERL_OPTIONS
          ** Options can be passed to the Erlang compiler using ERL_COMPILER_OPTIONS




          Also see: Get the compiler to exit if a compile-time warning is raised






          share|improve this answer























          • adding elixirc_options: [warnings_as_errors: false] to project/0 in mix.exs has no effect.
            – Ben Glasser
            Nov 19 '18 at 19:37












          • I understand why it's happening. I need to know how to turn it off.
            – Ben Glasser
            Nov 19 '18 at 19:38












          • Then there's probably an env variable or mix alias that's passing it as a flag. Take a look at the env flags exported by your elixir version manager and all tasks/aliases defined by your application.
            – Sheharyar
            Nov 19 '18 at 19:42











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53380878%2fhow-to-ignore-compilation-warnings-when-running-phoenix-server%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          The error message is pretty clear on that:




          Compilation failed due to warnings while using the --warnings-as-errors option




          You have this specific flag enabled on the compiler, it returns a non-zero exit code on warnings. Since you're not passing the option manually in the command-line, it's possible that it's being:




          • Set via an ENV variable (possibly by an Elixir version manager)

          • Being passed in a mix alias or task


          • But most probably it's hardcoded in your Mixfile under elixirc_options. You can disable it like this:



            # mix.exs
            elixirc_options: [warnings_as_errors: false]





          On a side note, to get help on compiler options, you should use elixirc:



          ± % elixirc --help
          Usage: elixirc [elixir switches] [compiler switches] [.ex files]

          -o The directory to output compiled files

          --help, -h Prints this message and exits
          --ignore-module-conflict Does not emit warnings if a module was previously defined
          --no-debug-info Does not attach debug info to compiled modules
          --no-docs Does not attach documentation to compiled modules
          --verbose Prints compilation status
          --version, -v Prints Elixir version and exits
          --warnings-as-errors Treats warnings as errors and return non-zero exit code

          ** Options given after -- are passed down to the executed code
          ** Options can be passed to the Erlang runtime using ELIXIR_ERL_OPTIONS
          ** Options can be passed to the Erlang compiler using ERL_COMPILER_OPTIONS




          Also see: Get the compiler to exit if a compile-time warning is raised






          share|improve this answer























          • adding elixirc_options: [warnings_as_errors: false] to project/0 in mix.exs has no effect.
            – Ben Glasser
            Nov 19 '18 at 19:37












          • I understand why it's happening. I need to know how to turn it off.
            – Ben Glasser
            Nov 19 '18 at 19:38












          • Then there's probably an env variable or mix alias that's passing it as a flag. Take a look at the env flags exported by your elixir version manager and all tasks/aliases defined by your application.
            – Sheharyar
            Nov 19 '18 at 19:42
















          4














          The error message is pretty clear on that:




          Compilation failed due to warnings while using the --warnings-as-errors option




          You have this specific flag enabled on the compiler, it returns a non-zero exit code on warnings. Since you're not passing the option manually in the command-line, it's possible that it's being:




          • Set via an ENV variable (possibly by an Elixir version manager)

          • Being passed in a mix alias or task


          • But most probably it's hardcoded in your Mixfile under elixirc_options. You can disable it like this:



            # mix.exs
            elixirc_options: [warnings_as_errors: false]





          On a side note, to get help on compiler options, you should use elixirc:



          ± % elixirc --help
          Usage: elixirc [elixir switches] [compiler switches] [.ex files]

          -o The directory to output compiled files

          --help, -h Prints this message and exits
          --ignore-module-conflict Does not emit warnings if a module was previously defined
          --no-debug-info Does not attach debug info to compiled modules
          --no-docs Does not attach documentation to compiled modules
          --verbose Prints compilation status
          --version, -v Prints Elixir version and exits
          --warnings-as-errors Treats warnings as errors and return non-zero exit code

          ** Options given after -- are passed down to the executed code
          ** Options can be passed to the Erlang runtime using ELIXIR_ERL_OPTIONS
          ** Options can be passed to the Erlang compiler using ERL_COMPILER_OPTIONS




          Also see: Get the compiler to exit if a compile-time warning is raised






          share|improve this answer























          • adding elixirc_options: [warnings_as_errors: false] to project/0 in mix.exs has no effect.
            – Ben Glasser
            Nov 19 '18 at 19:37












          • I understand why it's happening. I need to know how to turn it off.
            – Ben Glasser
            Nov 19 '18 at 19:38












          • Then there's probably an env variable or mix alias that's passing it as a flag. Take a look at the env flags exported by your elixir version manager and all tasks/aliases defined by your application.
            – Sheharyar
            Nov 19 '18 at 19:42














          4












          4








          4






          The error message is pretty clear on that:




          Compilation failed due to warnings while using the --warnings-as-errors option




          You have this specific flag enabled on the compiler, it returns a non-zero exit code on warnings. Since you're not passing the option manually in the command-line, it's possible that it's being:




          • Set via an ENV variable (possibly by an Elixir version manager)

          • Being passed in a mix alias or task


          • But most probably it's hardcoded in your Mixfile under elixirc_options. You can disable it like this:



            # mix.exs
            elixirc_options: [warnings_as_errors: false]





          On a side note, to get help on compiler options, you should use elixirc:



          ± % elixirc --help
          Usage: elixirc [elixir switches] [compiler switches] [.ex files]

          -o The directory to output compiled files

          --help, -h Prints this message and exits
          --ignore-module-conflict Does not emit warnings if a module was previously defined
          --no-debug-info Does not attach debug info to compiled modules
          --no-docs Does not attach documentation to compiled modules
          --verbose Prints compilation status
          --version, -v Prints Elixir version and exits
          --warnings-as-errors Treats warnings as errors and return non-zero exit code

          ** Options given after -- are passed down to the executed code
          ** Options can be passed to the Erlang runtime using ELIXIR_ERL_OPTIONS
          ** Options can be passed to the Erlang compiler using ERL_COMPILER_OPTIONS




          Also see: Get the compiler to exit if a compile-time warning is raised






          share|improve this answer














          The error message is pretty clear on that:




          Compilation failed due to warnings while using the --warnings-as-errors option




          You have this specific flag enabled on the compiler, it returns a non-zero exit code on warnings. Since you're not passing the option manually in the command-line, it's possible that it's being:




          • Set via an ENV variable (possibly by an Elixir version manager)

          • Being passed in a mix alias or task


          • But most probably it's hardcoded in your Mixfile under elixirc_options. You can disable it like this:



            # mix.exs
            elixirc_options: [warnings_as_errors: false]





          On a side note, to get help on compiler options, you should use elixirc:



          ± % elixirc --help
          Usage: elixirc [elixir switches] [compiler switches] [.ex files]

          -o The directory to output compiled files

          --help, -h Prints this message and exits
          --ignore-module-conflict Does not emit warnings if a module was previously defined
          --no-debug-info Does not attach debug info to compiled modules
          --no-docs Does not attach documentation to compiled modules
          --verbose Prints compilation status
          --version, -v Prints Elixir version and exits
          --warnings-as-errors Treats warnings as errors and return non-zero exit code

          ** Options given after -- are passed down to the executed code
          ** Options can be passed to the Erlang runtime using ELIXIR_ERL_OPTIONS
          ** Options can be passed to the Erlang compiler using ERL_COMPILER_OPTIONS




          Also see: Get the compiler to exit if a compile-time warning is raised







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 20 '18 at 20:25

























          answered Nov 19 '18 at 19:11









          SheharyarSheharyar

          44.1k10106160




          44.1k10106160












          • adding elixirc_options: [warnings_as_errors: false] to project/0 in mix.exs has no effect.
            – Ben Glasser
            Nov 19 '18 at 19:37












          • I understand why it's happening. I need to know how to turn it off.
            – Ben Glasser
            Nov 19 '18 at 19:38












          • Then there's probably an env variable or mix alias that's passing it as a flag. Take a look at the env flags exported by your elixir version manager and all tasks/aliases defined by your application.
            – Sheharyar
            Nov 19 '18 at 19:42


















          • adding elixirc_options: [warnings_as_errors: false] to project/0 in mix.exs has no effect.
            – Ben Glasser
            Nov 19 '18 at 19:37












          • I understand why it's happening. I need to know how to turn it off.
            – Ben Glasser
            Nov 19 '18 at 19:38












          • Then there's probably an env variable or mix alias that's passing it as a flag. Take a look at the env flags exported by your elixir version manager and all tasks/aliases defined by your application.
            – Sheharyar
            Nov 19 '18 at 19:42
















          adding elixirc_options: [warnings_as_errors: false] to project/0 in mix.exs has no effect.
          – Ben Glasser
          Nov 19 '18 at 19:37






          adding elixirc_options: [warnings_as_errors: false] to project/0 in mix.exs has no effect.
          – Ben Glasser
          Nov 19 '18 at 19:37














          I understand why it's happening. I need to know how to turn it off.
          – Ben Glasser
          Nov 19 '18 at 19:38






          I understand why it's happening. I need to know how to turn it off.
          – Ben Glasser
          Nov 19 '18 at 19:38














          Then there's probably an env variable or mix alias that's passing it as a flag. Take a look at the env flags exported by your elixir version manager and all tasks/aliases defined by your application.
          – Sheharyar
          Nov 19 '18 at 19:42




          Then there's probably an env variable or mix alias that's passing it as a flag. Take a look at the env flags exported by your elixir version manager and all tasks/aliases defined by your application.
          – Sheharyar
          Nov 19 '18 at 19:42


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53380878%2fhow-to-ignore-compilation-warnings-when-running-phoenix-server%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

          SQL update select statement

          'app-layout' is not a known element: how to share Component with different Modules