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

have NVM_PATH correct value? #1353

Closed
marcelino-m opened this issue Dec 15, 2016 · 12 comments
Closed

have NVM_PATH correct value? #1353

marcelino-m opened this issue Dec 15, 2016 · 12 comments

Comments

@marcelino-m
Copy link

NVM_PATH has value

/home/$USER/.nvm/versions/node/YOUR_NODE_VERSION/lib/node

but this file not exist, Is that correct?

Cheers

@ljharb
Copy link
Member

ljharb commented Dec 16, 2016

NVM_PATH is just an internal variable; it should be local and not exposed (359a83e)

What does nvm ls and nvm debug output? Is there an actual problem you're experiencing, or are you simply wondering about the contents of this env var?

@marcelino-m
Copy link
Author

marcelino-m commented Dec 16, 2016

I need to detect current version of node in my editor, so I look this variable for track this and find correct node_module/,
but I have to add a "../" string in path to use NVM_PATH

;; elisp code
 (concat (getenv "NVM_PATH")
               "/../node_modules/tern/emacs/")

Which would be a suitable way to find the folder node_module/ for the current version of node?

Cheers!

@ljharb
Copy link
Member

ljharb commented Dec 16, 2016

Use nvm current to get the current version of node, if you have a shell environment.

@marcelino-m
Copy link
Author

Ok, I am wondering now if is correct that value of NVM_PATH:

ls $NVM_PATH

result is :

ls: cannot access '/home/marcelo/.nvm/versions/node/v7.2.1/lib/node': No such file or directory 

nvm ls:

->       v7.2.1
default -> v7.2.1
node -> stable (-> v7.2.1) (default)
stable -> 7.2 (-> v7.2.1) (default)
iojs -> N/A (default)
lts/* -> lts/boron (-> N/A)
lts/argon -> v4.7.0 (-> N/A)
lts/boron -> v6.9.2 (-> N/A)

And nvm debug

nvm --version: v0.32.1
$SHELL: /bin/bash
$HOME: /home/marcelo
$NVM_DIR: '$HOME/.nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
nvm current: v7.2.1
which node: $NVM_DIR/versions/node/v7.2.1/bin/node
which iojs: 
which npm: $NVM_DIR/versions/node/v7.2.1/bin/npm
npm config get prefix: $NVM_DIR/versions/node/v7.2.1
npm root -g: $NVM_DIR/versions/node/v7.2.1/lib/node_modules

Cheers!

@ljharb
Copy link
Member

ljharb commented Dec 16, 2016

That doesn't seem correct - i'd expect node_modules at the end.

That said, nothing uses NVM_PATH so it doesn't really matter if it's broken - npm root -g should give you what you want.

@ljharb
Copy link
Member

ljharb commented Dec 16, 2016

I've removed $NVM_PATH entirely from the next version of nvm, so nobody's confused about it.

@ljharb ljharb closed this as completed in fcd6331 Dec 16, 2016
@marcelino-m
Copy link
Author

Ok!

@XadillaX
Copy link

So how can I use this env?

It's used in my VIM rc.

@XadillaX
Copy link

XadillaX commented Jan 15, 2018

let g:node_include_path = fnamemodify(
            \ fnamemodify($NVM_PATH, ':h'),
            \ ':h')
let g:syntastic_cpp_include_dirs = [
            \ g:node_include_path . '/include/node',
            \ g:node_include_path . '/lib/node_modules/nan',
            \...]

@ljharb
Copy link
Member

ljharb commented Jan 15, 2018

@XadillaX no idea what TNVM_PATH is, and NVM_PATH no longer exists; try npm root -g.

@XadillaX
Copy link

XadillaX commented Jan 15, 2018

So any environment variable to describe current Node.js version's root? e.g.

/Users/.../.nvm/versions/node/v8.9.2

Because the newest version break my VIM configuration.

@ljharb
Copy link
Member

ljharb commented Jan 15, 2018

No, there aren’t. Just a command: npm root -g or `which node etc

edwmurph pushed a commit to edwmurph/nvm that referenced this issue Apr 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants