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

Using the system node as default #1238

Open
rightaway opened this issue Sep 18, 2016 · 6 comments
Open

Using the system node as default #1238

rightaway opened this issue Sep 18, 2016 · 6 comments
Labels
needs followup We need some info or action from whoever filed this issue/PR.

Comments

@rightaway
Copy link

I've done nvm alias default system, and doing nvm use system shows Now using system version of node: v6.5.0 (npm v3.10.6). But if I do nvm exec system node app.js I get an error:

N/A: version "system" is not yet installed.

You need to run "nvm install system" to install it before using it.

What's the correct way to use the system node as the default? (I only switch to nvm versions of node when I'm in a directory with an .nvmrc.)

@ljharb
Copy link
Member

ljharb commented Sep 18, 2016

It sounds like you're saying having default aliased to system works fine, except with nvm exec (and presumably nvm run)?

@ljharb ljharb added the needs followup We need some info or action from whoever filed this issue/PR. label Sep 18, 2016
@rightaway
Copy link
Author

That's right. Both exec and run are failing. Other things seem to work alright, though I haven't tested much of yet but will be doing so.

Btw what exactly is the 'default' node, is it what's used anytime you're not in a directory with an .nvmrc? And sometimes I see people aliasing things to node rather than a particular version, what exactly does that do?

@ljharb
Copy link
Member

ljharb commented Sep 19, 2016

In nvm, node is just a default alias that always points to the latest version of node (nvm alias will print out the default aliases as well as your own).

If you don't use an .nvmrc anywhere, default is indeed what nvm auto-uses upon being sourced, ie in a new shell).

@rightaway
Copy link
Author

With regards to npm run/exec not working with system, is there any workaround I can use now that would let me access the system node while I'm in a folder with an .nvmrc, without having to leave that folder first? For example if I do npm list -g to show global packages for the system node it shows me global packages for the current nvm node. Same if I replace npm in that command with /usr/bin/npm, the path to the system node, it still shows nvm node's global packages.

Btw here is my output of nvm alias, where default points to system, but when why is there (default) next to the lines with node/stable/iojs?

default -> system
node -> stable (-> v6.5.0) (default)
stable -> 6.5 (-> v6.5.0) (default)
iojs -> N/A (default)
lts/* -> lts/argon (-> N/A)
lts/argon -> v4.5.0 (-> N/A)

@ljharb
Copy link
Member

ljharb commented Sep 19, 2016

You can always nvm use system, run your command, and then nvm use again to restore the folder's .nvmrc settings.

ljharb added a commit that referenced this issue Mar 31, 2017
edwmurph pushed a commit to edwmurph/nvm that referenced this issue Apr 9, 2018
@yoyo837
Copy link

yoyo837 commented Jun 17, 2022

nvm alias default system

Is this what you want?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs followup We need some info or action from whoever filed this issue/PR.
Projects
None yet
Development

No branches or pull requests

3 participants