abicky / nodejs-repl.el

Run Node.js REPL and communicate with the process
190 stars 38 forks source link

nvm-which fails if no .nvmrc present #38

Open titaniumbones opened 3 years ago

titaniumbones commented 3 years ago

Ifhtere's no nvm-which present, then the nvm-which funciton in the docs fails. I was able to fix it with:

  (defun nvm-which ()
    (let ((output (shell-command-to-string "source ~/.nvm/nvm.sh; nvm which")))
      (if (cl-search "Node Version" output)
          (setq output (shell-command-to-string "source ~/.nvm/nvm.sh; nvm which current"))
      (setq output (cadr (split-string output "[\n]+" t))))
    (message output)
    output))