Use .nvmrc if present #192

Merged
merged 2 commits into from Jan 25, 2013

Conversation

Projects
None yet
5 participants
@gpad
Contributor

gpad commented Jan 25, 2013

When you execute "nvm use" in a directory without specify a node version, if present a file .nvmrc that contain a node version, that version is used.

Example:
gpad@gpad-travel:/workspace$ mkdir nvm_example
gpad@gpad-travel:
/workspace$ cd nvm_example/
gpad@gpad-travel:/workspace/nvm_example$ echo "0.8.16" > .nvmrc
gpad@gpad-travel:
/workspace/nvm_example$ nvm use 0.6.3
Now using node v0.6.3
gpad@gpad-travel:/workspace/nvm_example$ node -v
v0.6.3
gpad@gpad-travel:
/workspace/nvm_example$ nvm use
Found .nvmrc files with version <0.8.16>
Now using node v0.8.16
gpad@gpad-travel:~/workspace/nvm_example$ node -v
v0.8.16

creationix added a commit that referenced this pull request Jan 25, 2013

Merge pull request #192 from gpad/nvmrc
Use .nvmrc if present

@creationix creationix merged commit 0ec339e into creationix:master Jan 25, 2013

@maumercado

This comment has been minimized.

Show comment Hide comment
@maumercado

maumercado Feb 11, 2013

When execute "nvm use" without the version its not loading the node version set on the .nvmrc file.

maumercado@Icio:[nodebeginner]$ nvm use
Found .nvmrc files with version <0.8.18>
Now using node

node is not loading, yet the $VERSION environment variable is there!

When execute "nvm use" without the version its not loading the node version set on the .nvmrc file.

maumercado@Icio:[nodebeginner]$ nvm use
Found .nvmrc files with version <0.8.18>
Now using node

node is not loading, yet the $VERSION environment variable is there!

@gpad

This comment has been minimized.

Show comment Hide comment
@gpad

gpad Feb 11, 2013

Contributor

Hi maumercado, can you post the content of .nvmrc?

Contributor

gpad commented Feb 11, 2013

Hi maumercado, can you post the content of .nvmrc?

@maumercado

This comment has been minimized.

Show comment Hide comment
@maumercado

maumercado Feb 11, 2013

the content is simply:
0.8.18

created it as the example -> echo "0.8.16" > .nvmrc

the content is simply:
0.8.18

created it as the example -> echo "0.8.16" > .nvmrc

@gpad

This comment has been minimized.

Show comment Hide comment
@gpad

gpad Feb 11, 2013

Contributor

I'm sorry, but it's a bug, I'm opening a n issue and creating a pull request

Contributor

gpad commented Feb 11, 2013

I'm sorry, but it's a bug, I'm opening a n issue and creating a pull request

@gpad

This comment has been minimized.

Show comment Hide comment
@gpad

gpad Feb 11, 2013

Contributor

This is the pull request if you want https://github.com/creationix/nvm/pull/195/files

Contributor

gpad commented Feb 11, 2013

This is the pull request if you want https://github.com/creationix/nvm/pull/195/files

@cliffano

This comment has been minimized.

Show comment Hide comment
@cliffano

cliffano Jun 19, 2013

Contributor

@gpad @creationix Is the use of 'function' here intentional?
I'm using nvm via Jenkins which uses /bin/sh by default, and it complains with "function not found" with this change.
The workaround I use is to change Jenkins to use /bin/bash as the shell of choice.

nvm used to work with /bin/sh, is it now a requirement to use a shell that supports 'function' keyword?

Contributor

cliffano commented on nvm.sh in bc9c82c Jun 19, 2013

@gpad @creationix Is the use of 'function' here intentional?
I'm using nvm via Jenkins which uses /bin/sh by default, and it complains with "function not found" with this change.
The workaround I use is to change Jenkins to use /bin/bash as the shell of choice.

nvm used to work with /bin/sh, is it now a requirement to use a shell that supports 'function' keyword?

This comment has been minimized.

Show comment Hide comment
@ljharb

ljharb Jun 19, 2013

Collaborator

Good call. The script should probably have a #!/bin/sh directive at the top, and this function should be an sh function, not a bash function. can you open an issue or a PR about it?

Collaborator

ljharb replied Jun 19, 2013

Good call. The script should probably have a #!/bin/sh directive at the top, and this function should be an sh function, not a bash function. can you open an issue or a PR about it?

This comment has been minimized.

Show comment Hide comment
@cliffano

cliffano Jun 21, 2013

Contributor

PR: #256

Contributor

cliffano replied Jun 21, 2013

PR: #256

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