[Tex/LaTex] Unknown MiKTeX exception

miktexpackagestexstudio

I'm new with latex and I just installed Miktex (2.9) and Texstudio (2.12.6) both in C:\Latex. Texstudio found the Miktex installation alright and now I tried to built the template that I wanted to use. It first says The required file tex\latex\nag\nag.sty is missing and when trying to install it, it will fail with Unknown MiKTeX exception. in the log file. Any idea how I can solve this?

It is very annoying to install every package via the package manager. It also will not just give me a list of all packages I need, no I need to rerun the build every time, say two times yes to the user control before I can copy the package name from the error message and install it via package manager. And I already did that 10 times and no end in sight.

Full error log:

2017-10-27 23:45:52,564+0200 INFO  miktex-pdftex - starting with command line: C:\Latex\Miktex\miktex\bin\x64\miktex-pdftex.exe -synctex=1 -undump=pdflatex main.tex
2017-10-27 23:45:54,771+0200 INFO  miktex-pdftex - installing package url triggered by tex\latex\url\url.sty
2017-10-27 23:45:55,814+0200 FATAL miktex-pdftex - Unknown MiKTeX exception.
2017-10-27 23:45:55,814+0200 FATAL miktex-pdftex - Info: =""
2017-10-27 23:45:55,814+0200 FATAL miktex-pdftex - Source: 
2017-10-27 23:45:55,814+0200 FATAL miktex-pdftex - Line: 0

Best Answer

Questions about problems with MikTeX often appear here. There are two possible "general purpose" solutions:

(1) Instead of ordinary MikTeX, install MikTeX portable version, and put the files in a new subfolder of your user home directory. This does not requires administrative privilege. So, if the underlying problem has something to do with access rights, this solves the problem. Downside: Not suitable for a multi-user installation.

(2) If you cannot install a package via the usual MikTeX package manager, then you can get it from CTAN. However, MikTeX is very particular about how packages are installed. If you get the package without using MikTeX internal package manager, then place the downloaded files within your texmf-local directory, using proper folder tree. So, a package such as "dribble" probably should have its *.sty and related filed in (texmf-local)/tex/latex/dribble. Usually, but not always! Then update FNDB.

If neither of the above works for you, then something about your MikTeX installation is borked. Can't help there.