copilot-emacs / copilot.el

An unofficial Copilot plugin for Emacs.
MIT License
1.83k stars 128 forks source link

Node executable not found in package but elisp finds it otherwise fine. #44

Closed dschonholtz closed 2 years ago

dschonholtz commented 2 years ago

I installed node 17 with nvm. When I run the following code I get the following path:

emacs --script test.el /home/douglas/.nvm/versions/node/v17.9.1/bin/node

;; test.el
(defcustom copilot-node-executable
  (if (eq system-type 'windows-nt)
      "node.exe"
    "node")
  "Node executable path."
  :group 'copilot
  :type 'string)

(message
 (locate-file copilot-node-executable exec-path))

But when I attempt to run the copilot login I get the following in Messages

Could not find node executable
cl-no-applicable-method: No applicable method: jsonrpc--request-continuations, nil

With the following stack trace:

Debugger entered--Lisp error: (cl-no-applicable-method jsonrpc--next-request-id nil)
  signal(cl-no-applicable-method (jsonrpc--next-request-id nil))
  cl-no-applicable-method(#s(cl--generic :name jsonrpc--next-request-id :dispatches ((0 #s(cl--generic-generalizer :name eieio--generic-generalizer :priority 50 :tagcode-function cl--generic-struct-tag :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0xa6a2d1c4cbedd43>)) #s(cl--generic-generalizer :name cl--generic-t-generalizer :priority 0 :tagcode-function #f(compiled-function (name &rest _) #<bytecode -0x1cba9713a96764e4>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode -0x2b7bed08469105e>)))) :method-table (#s(cl--generic-method :specializers (jsonrpc-connection) :qualifiers nil :uses-cnm nil :function #f(compiled-function (this) "Retrieve the slot `-next-request-id' from an object of class\n`jsonrpc-connection'." #<bytecode -0xdffec517024eae5>))) :options nil) nil)
  apply(cl-no-applicable-method #s(cl--generic :name jsonrpc--next-request-id :dispatches ((0 #s(cl--generic-generalizer :name eieio--generic-generalizer :priority 50 :tagcode-function cl--generic-struct-tag :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0xa6a2d1c4cbedd43>)) #s(cl--generic-generalizer :name cl--generic-t-generalizer :priority 0 :tagcode-function #f(compiled-function (name &rest _) #<bytecode -0x1cba9713a96764e4>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode -0x2b7bed08469105e>)))) :method-table (#s(cl--generic-method :specializers (jsonrpc-connection) :qualifiers nil :uses-cnm nil :function #f(compiled-function (this) "Retrieve the slot `-next-request-id' from an object of class\n`jsonrpc-connection'." #<bytecode -0xdffec517024eae5>))) :options nil) nil)
  #f(compiled-function (&rest args) #<bytecode 0x1196376db8a06fb3>)(nil)
  apply(#f(compiled-function (&rest args) #<bytecode 0x1196376db8a06fb3>) nil nil)
  jsonrpc--next-request-id(nil)
  jsonrpc--async-request-1(nil signInInitiate 'nil :success-fn #f(compiled-function (result) #<bytecode -0x1476dbebf9018fc4>) :error-fn #f(compiled-function (jsonrpc-lambda-elem0) #<bytecode -0x112d31fbc699068b>) :timeout-fn #f(compiled-function () #<bytecode -0x1feb8137e6e23598>))
  apply(jsonrpc--async-request-1 nil signInInitiate 'nil :success-fn #f(compiled-function (result) #<bytecode -0x1476dbebf9018fc4>) :error-fn #f(compiled-function (jsonrpc-lambda-elem0) #<bytecode -0x112d31fbc699068b>) :timeout-fn #f(compiled-function () #<bytecode -0x1feb8137e6e23598>) nil)
  jsonrpc-request(nil signInInitiate 'nil)
  copilot-login()
  funcall-interactively(copilot-login)
  command-execute(copilot-login record)
  counsel-M-x-action("copilot-login")
  ivy-call()
  ivy-read("M-x " [## 0 vc-src-responsible-p timer-next-integral-multiple-of-time tramp-sudoedit-file-name-handler tramp-completion-handle-file-name-all-completions jsonrpc-name straight-vc-clone backquote-listify eglot-reconnect ert-test-passed-duration--cmacro help-follow-symbol pcomplete-stub japanese-hiragana-two-byte cc-vars dired-unmark-all-marks znc uniquify-rename-buffer inactive f-ancestor-of\? files--splice-dirname-file raw-text-dos lisp-mode-map info--manual-names 0 copilot-login minibuffer-text-before-history compilation-error-list kmacro-pop-ring1 min-width-safe nexus byte-condition-case tramp-sudoedit-handle-set-file-acl xref--push-markers vc-bzr-shelve-menu nswbuff 0 swiper-include-line-number-in-search browse-url-generic-args kmacro-p use-package-handler/:interpreter 0 filename-and-process slot-unbound :match check-declare xref-group counsel--async-filter tramp-handle-make-auto-save-file-name ls-lisp-handle-switches ...] :predicate #f(compiled-function (sym) #<bytecode -0x87b642a6c43fae2>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
  counsel-M-x()
  funcall-interactively(counsel-M-x)
  command-execute(counsel-M-x)

My guess is there is some weird pathing thing here? Where the node executable isn't getting seen for some reason wherever the list code in package is getting run?

In any case I am going to sleep for now

zerolfx commented 2 years ago

I'm not sure why it couldn't find the path, but you can set it manually by (setq copilot-node-executable "/path/to/node").

dschonholtz commented 2 years ago

This worked! Thank you