Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use nvm.el #1

Open
scottaj opened this issue Jan 24, 2016 · 4 comments
Open

Use nvm.el #1

scottaj opened this issue Jan 24, 2016 · 4 comments

Comments

@scottaj
Copy link
Owner

scottaj commented Jan 24, 2016

No description provided.

@scottaj
Copy link
Owner Author

scottaj commented Feb 3, 2016

This is pretty low priority. The current technique of just specifying which node to use works really well.

@dcluna
Copy link

dcluna commented Sep 6, 2017

In case someone needs a quick fix for this, I have something like the following in my .dir-locals.el:

((js2-mode . ((eval . (progn
                       (setq mocha-which-node
                             (if (boundp 'nvm-current-version)
                                 (concat (cadr nvm-current-version) "/bin/node")
                               (concat (getenv "HOME") "/.nvm/versions/node/v" (s-chomp (f-read-text (concat default-directory ".nvmrc"))) "/bin/node" )))
                       ))
;; other vars here...
              )))

Notice that I'm relying on this file being in the root of the project, the same place where .nvmrc is located.

@Fuco1
Copy link

Fuco1 commented Oct 18, 2017

@dcluna I've replaced default-directory with (locate-dominating-file default-directory "package.json") so it works from nested directories as well. I like the solution, at least for a while.

@felipeochoa
Copy link
Collaborator

felipeochoa commented Dec 3, 2017

If you're using nvm.el, once this PR is merged, you can add something like this to your init file:

(add-hook 'js2-mode-hook 'nvm-use-for-buffer)

Then, leaving mocha-which-node as node will work if you've defined an .nvmrc file, without having to mess around with dir locals (particularly eval)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants