I installed Emacs via Chocolatey on Windows 10 because my Linux PC is out of commission. For some reason it will not run unless I specify the whole path (I checked the %PATH% variable and C:\ProgramData\chocolatey\bin was not in the user path, only the admin path, so I added it but it didn’t change a thing). I created the %EMACS% variable (because I read that sometimes that is necessary), and it still did not fix anything. Why are all the instructions for installing Emacs out of date or don’t work? The choco install worked but none of the programmes it installed (e.g. git.exe) are actually recognised as existing in the path even though I checked and they are in the right folder.
Steps to reproduce
Follow the steps from here (updating where necessary, e.g. changing the git repository): https://www.ccammack.com/posts/install-doom-emacs-on-windows/
It will install Emacs but it will be inaccessible except by directly executing it (i.e. it acts like it is not in the %PATH%, even though it is). When running cmd or PowerShell as admin it is the same.
System information
Windows 10
Update
I needed to reboot my computer to get the commands in the chocolatey\bin folder to be recognised properly in the path. However, doom install is still causing trouble:
.emacs.d\bin\doom install
Error: doom-core-error ("c:/Users/ethan/.emacs.d/lisp/doom-cli.el" (native-compiler-error (lambda (arg3 &rest arg4) (let ((f #'message)) (apply f arg3 arg4))) "Compiling c:/Users/ethan/.emacs.d/.local/cache/eln/29.4-a4386b77/subr--trampoline-6d657373616765_message_0.eln...
x86_64-w64-mingw32-gcc-11.3.0: fatal error: cannot execute 'as': CreateProcess: No such file or directory
compilation terminated.
"))
mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode 0x76185e9e86ee64c>))
debug-early-backtrace()
debug-early(error (doom-core-error "c:/Users/ethan/.emacs.d/lisp/doom-cli.el" (native-compiler-error (lambda (arg3 &rest arg4) (let ((f #'message)) (apply f arg3 arg4))) "Compiling c:/Users/ethan/.emacs.d/.local/cache/eln/29.4-a4386b77/subr--trampoline-6d657373616765_message_0.eln...\nx86_64-w64-mingw32-gcc-11.3.0: fatal error: cannot execute 'as': CreateProcess: No such file or directory\ncompilation terminated.\n")))
signal(doom-core-error ("c:/Users/ethan/.emacs.d/lisp/doom-cli.el" (native-compiler-error (lambda (arg3 &rest arg4) (let ((f #'message)) (apply f arg3 arg4))) "Compiling c:/Users/ethan/.emacs.d/.local/cache/eln/29.4-a4386b77/subr--trampoline-6d657373616765_message_0.eln...\nx86_64-w64-mingw32-gcc-11.3.0: fatal error: cannot execute 'as': CreateProcess: No such file or directory\ncompilation terminated.\n")))
(condition-case e (load path noerror 'nomessage) ((debug doom-error) (signal (car e) (cdr e))) ((debug error) (setq path (locate-file path load-path (get-load-suffixes))) (signal (cond ((not (and path (featurep 'doom))) 'error) ((file-in-directory-p path (expand-file-name "cli" doom-core-dir)) 'doom-cli-error) ((file-in-directory-p path doom-core-dir) 'doom-core-error) ((file-in-directory-p path doom-user-dir) 'doom-user-error) ((file-in-directory-p path doom-profile-dir) 'doom-profile-error) ((file-in-directory-p path doom-modules-dir) 'doom-module-error) ('doom-error)) (list path e))))
doom-load("doom-cli" nil)
(or (featurep feature subfeature) (doom-load (if subfeature (file-name-concat doom-core-dir (string-remove-prefix "doom-" (symbol-name feature)) (symbol-name filename)) (symbol-name feature)) noerror))
(let ((subfeature (if (symbolp filename) filename))) (or (featurep feature subfeature) (doom-load (if subfeature (file-name-concat doom-core-dir (string-remove-prefix "doom-" (symbol-name feature)) (symbol-name filename)) (symbol-name feature)) noerror)))
doom-require(doom-cli)
(if (let ((load-suffixes '(".elc" ".el"))) (condition-case _ (load (expand-file-name "lisp/doom" user-emacs-directory) nil (not init-file-debug) nil 'must-suffix) ((debug file-missing) (prog1 (defalias 'startup--load-user-init-file@reroute-to-profile #'(lambda (args) (list #'(lambda nil (expand-file-name "init.el" user-emacs-directory)) nil (nth 2 args)))) (advice-add 'startup--load-user-init-file :filter-args #'startup--load-user-init-file@reroute-to-profile)) (setq user-init-file (expand-file-name "early-init" user-emacs-directory)) (setq load-prefer-newer t) (setq gc-cons-threshold (* 16 1024 1024)) nil))) (doom-require (if noninteractive 'doom-cli 'doom-start)))
(let (file-name-handler-alist) (let ((command-line-args (if noninteractive nil command-line-args)) (profile (or (car (cdr (member "--profile" command-line-args))) (getenv-internal "DOOMPROFILE")))) (if (null profile) (let ((init-dir (or (car (cdr (member "--init-directory" command-line-args))) (getenv-internal "EMACSDIR")))) (if (null init-dir) (if noninteractive (progn (setq user-emacs-directory (file-name-directory (file-truename load-file-name))))) (setq command-switch-alist (cons (cons "--init-directory" #'(lambda (_) (car-safe (prog1 argv (setq argv (cdr argv)))))) command-switch-alist)) (setq user-emacs-directory (expand-file-name init-dir)))) (setq command-switch-alist (cons (cons "--profile" #'(lambda (_) (car-safe (prog1 argv (setq argv (cdr argv)))))) command-switch-alist)) (setenv "DOOMPROFILE" profile) (or (load (expand-file-name (format (let ((lfile (getenv-internal "DOOMPROFILELOADFILE"))) (if lfile (concat (let ((suffix ".el")) (if (string-suffix-p suffix lfile) (substring lfile 0 (- (length lfile) (length suffix))) lfile)) ".%d.elc") "profiles/load.%d.elc")) emacs-major-version) user-emacs-directory) 'noerror (not init-file-debug) 'nosuffix) (user-error "Profiles not initialized yet; run 'doom sync' first")))) (if (let ((load-suffixes '(".elc" ".el"))) (condition-case _ (load (expand-file-name "lisp/doom" user-emacs-directory) nil (not init-file-debug) nil 'must-suffix) ((debug file-missing) (prog1 (defalias 'startup--load-user-init-file@reroute-to-profile #'(lambda (args) (list #'(lambda nil (expand-file-name "init.el" user-emacs-directory)) nil (nth 2 args)))) (advice-add 'startup--load-user-init-file :filter-args #'startup--load-user-init-file@reroute-to-profile)) (setq user-init-file (expand-file-name "early-init" user-emacs-directory)) (setq load-prefer-newer t) (setq gc-cons-threshold (* 16 1024 1024)) nil))) (doom-require (if noninteractive 'doom-cli 'doom-start))))
(or (let (file-name-handler-alist) (let ((command-line-args (if noninteractive nil command-line-args)) (profile (or (car (cdr (member "--profile" command-line-args))) (getenv-internal "DOOMPROFILE")))) (if (null profile) (let ((init-dir (or (car (cdr (member "--init-directory" command-line-args))) (getenv-internal "EMACSDIR")))) (if (null init-dir) (if noninteractive (progn (setq user-emacs-directory (file-name-directory (file-truename load-file-name))))) (setq command-switch-alist (cons (cons "--init-directory" #'(lambda (_) (car-safe (prog1 argv (setq argv (cdr argv)))))) command-switch-alist)) (setq user-emacs-directory (expand-file-name init-dir)))) (setq command-switch-alist (cons (cons "--profile" #'(lambda (_) (car-safe (prog1 argv (setq argv (cdr argv)))))) command-switch-alist)) (setenv "DOOMPROFILE" profile) (or (load (expand-file-name (format (let ((lfile (getenv-internal "DOOMPROFILELOADFILE"))) (if lfile (concat (let ((suffix ".el")) (if (string-suffix-p suffix lfile) (substring lfile 0 (- (length lfile) (length suffix))) lfile)) ".%d.elc") "profiles/load.%d.elc")) emacs-major-version) user-emacs-directory) 'noerror (not init-file-debug) 'nosuffix) (user-error "Profiles not initialized yet; run 'doom sync' first")))) (if (let ((load-suffixes '(".elc" ".el"))) (condition-case _ (load (expand-file-name "lisp/doom" user-emacs-directory) nil (not init-file-debug) nil 'must-suffix) ((debug file-missing) (prog1 (defalias 'startup--load-user-init-file@reroute-to-profile #'(lambda (args) (list #'(lambda nil (expand-file-name "init.el" user-emacs-directory)) nil (nth 2 args)))) (advice-add 'startup--load-user-init-file :filter-args #'startup--load-user-init-file@reroute-to-profile)) (setq user-init-file (expand-file-name "early-init" user-emacs-directory)) (setq load-prefer-newer t) (setq gc-cons-threshold (* 16 1024 1024)) nil))) (doom-require (if noninteractive 'doom-cli 'doom-start)))) (load user-init-file 'noerror (not init-file-debug) nil 'must-suffix))
load-with-code-conversion("c:/Users/ethan/.emacs.d/early-init.el" "c:/Users/ethan/.emacs.d/early-init.el" nil t)
load("c:/Users/ethan/.emacs.d/early-init.el" nil nomessage nosuffix)
(and (load init-file nil 'nomessage 'nosuffix) (featurep 'doom))
(or (and (load init-file nil 'nomessage 'nosuffix) (featurep 'doom)) (user-error "Failed to load Doom from %s" init-file))
(let* ((bin-dir (file-name-directory (file-truename load-file-name))) (init-file (expand-file-name "../early-init.el" bin-dir))) (or (and (load init-file nil 'nomessage 'nosuffix) (featurep 'doom)) (user-error "Failed to load Doom from %s" init-file)))
(condition-case e (let* ((bin-dir (file-name-directory (file-truename load-file-name))) (init-file (expand-file-name "../early-init.el" bin-dir))) (or (and (load init-file nil 'nomessage 'nosuffix) (featurep 'doom)) (user-error "Failed to load Doom from %s" init-file))) (user-error (message "Error: %s" (car (cdr e))) (kill-emacs 2)))
#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_99>(#<buffer *load*> "c:/Users/ethan/.emacs.d/bin/doom")
load-with-code-conversion("c:/Users/ethan/.emacs.d/bin/doom" "c:/Users/ethan/.emacs.d/bin/doom" nil t #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_99>)
command-line--load-script("c:/Users/ethan/.emacs.d/bin/doom")
command-line-1(("-scriptload" ".\\doom" "--" "install"))
command-line()
normal-top-level()
Unexpected error in Doom's core: "c:/Users/ethan/.emacs.d/lisp/doom-cli.el", (native-compiler-error (lambda (arg3 &rest arg4) (let ((f #'message)) (apply f arg3 arg4))) "Compiling c:/Users/ethan/.emacs.d/.local/cache/eln/29.4-a4386b77/subr--trampoline-6d657373616765_message_0.eln...
x86_64-w64-mingw32-gcc-11.3.0: fatal error: cannot execute 'as': CreateProcess: No such file or directory
compilation terminated.
")
Correction
Tried again, and this time followed the instructions regarding environment variables more closely, setting them before installing Emacs. Now I can’t even launch vanilla Emacs, and this is what I get when I do so (in the Emacs window):
comp——native—compile: Native compiler error:
(lambda (arg6 &optional arg7 arg8 arg9 arglO) (let
c:/Users/ejb/ . emacs.d/ . local/ cache/eIn/29.4—a4386b77/subr——trampoIine—6c6f6164 load O.eln. ..
x86 64—w64—mingw32—gcc—II.3.O: fatal error:
cannot execute 'as' : Createprocess: No such file or
compilation terminated.
( (f # 'load))
directory
(funcall f arg6 arg7 arg8 arg9 arglO) ) ) ,
T'CompiIing
(Sorry if it looks weird, I had to grab it using the Text Extractor included in Microsoft PowerToys (basically a useful utilities package.)