Comments (15)
That sounds a bit of a chicken and egg problem. On my bash in a vanilla Ubuntu system, I never have trouble sourcing nvm in a clean environment. Do you have anything custom or aliases setup?
from nvm.
What is the value of $?
after sourcing nvm.sh? With the current master, mine is always '13' before I've installed a particular node version. I can also trigger this by simply removing the default alias:
$ source ~/.nvm/nvm.sh
$ echo $?
0
$ rm ~/.nvm/alias/default
$ source ~/.nvm/nvm.sh
Exit 13
$ echo $?
13
Restoring the alias default removes the failure. My recommendation would be to remove the 'return 13' in the case it can't find an installed node version and only error when someone attempts to pick a node version that doesn't exit.
FWIW, the following bashrc function helps diagnose commands that fail by printing the return value of the previous command if not zero:
# Display exit status of previous command on failure
#
function printexitvalue()
{
local SAVE_EXIT=$?
if [ $SAVE_EXIT -ne 0 ]; then
echo "Exit $SAVE_EXIT";
fi
return $SAVE_EXIT
}
export PROMPT_COMMAND=printexitvalue
from nvm.
Sorry, I didn't see your comment. Did you ever resolve this?
from nvm.
I believe I worked around it by ignoring the error and preceding with installing a node and setting it as default. I'd imagine the original error is still present though, see earlier comment for how to reproduce.
from nvm.
I understand. Nothing is broken, it's just that in your environment, you're able to see the error code that I can't see in a vanilla bash environment. I'll look into fixing it if it bothers more people.
from nvm.
I think I'm having the same problem; installed a fresh Ubuntu 11.04 system and sourced nvm
. Tried nvm install stable
: it downloads the source but errors out with the following:
nvm: install v0.4.11 failed!
It does download the source to the current directory, though.
ADDED: I've additionally installed build-essential
, openssl
and libssl-dev
to no avail. Node's ./configure
shows all green.
from nvm.
Okay, installing the latest node from master branch using the following:
./configure
make
sudo make install
And then opening a new shell (while having . ~/.nvm/nvm.sh
in my .bashrc
) and running nvm install stable
from my home directory seems to have done its job.
As a side effect, I've now seen that the nvm install
behaves differently; in previous attempts it showed the standard curl
messages (progress bars and all), while this time round it showed the familiar hash signs and counted up to 100%. If that helps any, I'm really bad at bash and can't point my finger to any of the parts of the sourced script.
from nvm.
I have the same problem when I upgrade my laptop to ubuntu 11.10. I didn't install any nodejs package at first, then I tried to install nodejs through nvm, but it always display "install failed!" (Both v0.4.x & v0.5.x)
I put some debug code and find out that
https://github.com/creationix/nvm/blob/master/nvm.sh#L106-110
The if else not work correctly, so the tarball would be null then program goes fail.
Then I do the same thing just like KrofDrakula did, fetch the node source code and install. After that, nvm could work fine.
Any advice? Thank.
from nvm.
I also have the same problem. On a vanilla Ubuntu 11.10, NVM fails to install v0.4.12. However, it seems to have downloaded the tarball correctly. Any thoughts on the problem?
from nvm.
I figured out the problem... for some reason on Ubuntu 11.10, emulation with curl is happening from the nvm.sh script. Remove that portion in the beginning of the nvm.sh file and source the update. Then make sure that the actual curl binary is installed.
Why any dependence upon wget? Why not just a dependence upon curl? Why bother trying to emulate curl with wget?
from nvm.
Desktop Linux doesn't usually have curl installed by default, but it does have wget. I always install curl and I think any serious web developer should have curl, but I'm not sure I should force that opinion on others. Either way, the wget emulation doesn't seem to work so I should probably remove it.
from nvm.
I'd suggest the script check the availability of curl
and get rid of the use of wget
altogether. If curl
is not available, simply fail with an error message stating that curl
needs to be installed as a prerequisite.
EDIT: just tried the suggestion by @jprichardson – installing curl
on a vanilla Ubuntu instance (11.04) prior to running nvm install v0.4.12
does the trick, if anyone's still stuck.
from nvm.
Fixed in 8dad534
from nvm.
Awesome, thanks. Informative errors are way cool. :)
from nvm.
Excellent! Thanks for fixing this!
from nvm.
Related Issues (20)
- [spam]
- terminal locked > sh-5.2$ from "wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash" HOT 9
- node doesn't initialize until "nvm use ..." is ran HOT 2
- install node 14 on mac m2 failed HOT 1
- Errors compiling 14.20.0 on Apple silicon with latest xcode-tools. HOT 1
- Node version does not persist across new terminal sessions after macOS restart HOT 3
- [BUG] `nvm` uses `most` even when `most` is not installed HOT 6
- Node.js v21.7.1 documentation
- `nvm install 14` compile fails HOT 2
- Installation : The term 'bash' is not recognized as the name HOT 7
- Installation Error: Invoke-WebRequest : A parameter cannot be found that matches parameter name 'o-' HOT 2
- Feature Request: General Name for Install Script HOT 2
- nvm ls-remote returns N/A HOT 4
- NVM just will not change version of node HOT 8
- Problems installing/using nvm in AppCenter HOT 2
- Long loading times fixed by better design HOT 1
- [spam]
- NVM problem with corepack and yarn HOT 1
- Curl Error HOT 9
- Error, parse error near `do' when trying to install MacOS HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvm.