Got Error message "Error: invalid version 0.10.8" while using n in FreeBSD #116

Closed
benpptung opened this Issue May 25, 2013 · 9 comments

Comments

Projects
None yet
8 participants
@benpptung

Today, I try to install Node.js on FreeBSD by using the port tree /www/node, /www/npm,
Then, I install npm n by:

# npm install -g n

The current version of /www/node at FreeBSD is 0.10.5, so I issue the following command, and hope to upgrade to node.js 0.10.8:

# n stable

However, I got the following error

install : 0.10.8

Error: invalid version 0.10.8

Don't know why I cannot use n to upgrade node.js,
Is this a problem because I use port tree to install node.js?

Thank you in advance, and please advise.

@insequor

This comment has been minimized.

Show comment Hide comment
@insequor

insequor Oct 8, 2013

I was just trying to upgrade my node version as well using the information from this link: http://davidwalsh.name/upgrade-nodejs
I get the same error, I tried different version numbers and all give the same error.

insequor commented Oct 8, 2013

I was just trying to upgrade my node version as well using the information from this link: http://davidwalsh.name/upgrade-nodejs
I get the same error, I tried different version numbers and all give the same error.

@insequor

This comment has been minimized.

Show comment Hide comment
@insequor

insequor Oct 8, 2013

Correction: In my case there was an additional error message which I didn't see at first: It complains that I do not have "curl" installed. Once I install the curl, upgrade went ok.

$ sudo n stable
install : 0.10.20
mkdir : /usr/local/n/versions/0.10.20
fetch : http://nodejs.org/dist/v0.10.20/node-v0.10.20-linux-x86.tar.gz /usr/bin/node
installed : v0.10.20

I am using ubuntu in a VM (through vagrant) on windows and I am accessing the machine with putty. After upgrades node still showed the old version. I restarted the machine and now it shows v0.10.20. .

insequor commented Oct 8, 2013

Correction: In my case there was an additional error message which I didn't see at first: It complains that I do not have "curl" installed. Once I install the curl, upgrade went ok.

$ sudo n stable
install : 0.10.20
mkdir : /usr/local/n/versions/0.10.20
fetch : http://nodejs.org/dist/v0.10.20/node-v0.10.20-linux-x86.tar.gz /usr/bin/node
installed : v0.10.20

I am using ubuntu in a VM (through vagrant) on windows and I am accessing the machine with putty. After upgrades node still showed the old version. I restarted the machine and now it shows v0.10.20. .

@2hu12

This comment has been minimized.

Show comment Hide comment
@2hu12

2hu12 Sep 7, 2014

Is there a solution?

2hu12 commented Sep 7, 2014

Is there a solution?

@tjwebb

This comment has been minimized.

Show comment Hide comment
@tjwebb

tjwebb Sep 7, 2014

Collaborator

you need to uninstall all other versions of node first.

Collaborator

tjwebb commented Sep 7, 2014

you need to uninstall all other versions of node first.

@newshorts

This comment has been minimized.

Show comment Hide comment
@newshorts

newshorts Oct 15, 2014

Thanks tjwebb, however that didn't solve my issue. I recently upgraded to mavericks and found that certain node modules werent working. I uninstalled node and npm, then reinstalled node and npm. Then removed node, but keeping npm. I still cant seem to get n working to install different versions of node.

I have an error log if anyone is interested:

$ sudo n stable
Password:

     install : v0.10.32
Unknown option: n
Usage: head [-options] <url>...
    -m <method>   use method for the request (default is 'HEAD')
    -f            make request even if head believes method is illegal
    -b <base>     Use the specified URL as base
    -t <timeout>  Set timeout value
    -i <time>     Set the If-Modified-Since header on the request
    -c <conttype> use this content-type for POST, PUT, CHECKIN
    -a            Use text mode for content I/O
    -p <proxyurl> use this as a proxy
    -P            don't load proxy settings from environment
    -H <header>   send this HTTP header (you can specify several)

    -u            Display method and URL before any response
    -U            Display request headers (implies -u)
    -s            Display response status code
    -S            Display response status chain
    -e            Display response headers
    -d            Do not display content
    -o <format>   Process HTML content in various ways

    -v            Show program version
    -h            Print this message

    -x            Extra debugging output
(23) Failed writing body

  Error: invalid version 0.10.32

Thanks tjwebb, however that didn't solve my issue. I recently upgraded to mavericks and found that certain node modules werent working. I uninstalled node and npm, then reinstalled node and npm. Then removed node, but keeping npm. I still cant seem to get n working to install different versions of node.

I have an error log if anyone is interested:

$ sudo n stable
Password:

     install : v0.10.32
Unknown option: n
Usage: head [-options] <url>...
    -m <method>   use method for the request (default is 'HEAD')
    -f            make request even if head believes method is illegal
    -b <base>     Use the specified URL as base
    -t <timeout>  Set timeout value
    -i <time>     Set the If-Modified-Since header on the request
    -c <conttype> use this content-type for POST, PUT, CHECKIN
    -a            Use text mode for content I/O
    -p <proxyurl> use this as a proxy
    -P            don't load proxy settings from environment
    -H <header>   send this HTTP header (you can specify several)

    -u            Display method and URL before any response
    -U            Display request headers (implies -u)
    -s            Display response status code
    -S            Display response status chain
    -e            Display response headers
    -d            Do not display content
    -o <format>   Process HTML content in various ways

    -v            Show program version
    -h            Print this message

    -x            Extra debugging output
(23) Failed writing body

  Error: invalid version 0.10.32
@sogko

This comment has been minimized.

Show comment Hide comment
@sogko

sogko Oct 23, 2014

+1 for getting similar errors as @newshorts when running sudo n stable on OSX Mavericks, current NodeJS v.0.10.26

  • Error: invalid version x.x.x
  • (23) Failed writing body
  • (and this is a curious one): Unknown option: n
     install : v0.10.32
Unknown option: n
Usage: head [-options] <url>...
    -m <method>   use method for the request (default is 'HEAD')
    -f            make request even if head believes method is illegal
    -b <base>     Use the specified URL as base
    -t <timeout>  Set timeout value
    -i <time>     Set the If-Modified-Since header on the request
    -c <conttype> use this content-type for POST, PUT, CHECKIN
    -a            Use text mode for content I/O
    -p <proxyurl> use this as a proxy
    -P            don't load proxy settings from environment
    -H <header>   send this HTTP header (you can specify several)

    -u            Display method and URL before any response
    -U            Display request headers (implies -u)
    -s            Display response status code
    -S            Display response status chain
    -e            Display response headers
    -d            Do not display content
    -o <format>   Process HTML content in various ways

    -v            Show program version
    -h            Print this message

    -x            Extra debugging output
(23) Failed writing body

  Error: invalid version 0.10.32

While writing this, I just realised that the error message comes from curl head.
Will investigate further.

Here's my environment:
OSX Mountain Lion
NodeJS v0.10.26
curl v7.30.0
head v2.07

node -v
v0.10.26

curl --version
curl 7.30.0 (x86_64-apple-darwin10.0.0) libcurl/7.30.0 OpenSSL/1.0.1e zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP

head -v
This is lwp-request version 2.07 (libwww-perl-5.805)
...

Update 1
n was trying to execute the following command:

$ curl -Is http://nodejs.org/dist/v0.10.32/node-v0.10.32-darwin-x64.tar.gz | head -n 1 | grep 200

Update 2
Found the cause of the problem for my case (TL;DR Wrong head)

When I realised that the error was coming from head, I did a which head and found out it was pointing to a different head

$ which head
/Applications/XAMPP/xamppfiles/bin/head #<--- whaaat

Turns out, in my case, I've installed XAMPP and it has a HEAD executable in its bin folder which was in $PATH and confused the hell out of OSX (not really, it just took the first one it found)

$ echo $PATH
/Applications/XAMPP/xamppfiles/bin:....

Simply edited the $PATH env variable in my profile and hey:

$ which head
/usr/bin/head # yay! my head!

Now sudo n stable works as expected.

Thanks!

sogko commented Oct 23, 2014

+1 for getting similar errors as @newshorts when running sudo n stable on OSX Mavericks, current NodeJS v.0.10.26

  • Error: invalid version x.x.x
  • (23) Failed writing body
  • (and this is a curious one): Unknown option: n
     install : v0.10.32
Unknown option: n
Usage: head [-options] <url>...
    -m <method>   use method for the request (default is 'HEAD')
    -f            make request even if head believes method is illegal
    -b <base>     Use the specified URL as base
    -t <timeout>  Set timeout value
    -i <time>     Set the If-Modified-Since header on the request
    -c <conttype> use this content-type for POST, PUT, CHECKIN
    -a            Use text mode for content I/O
    -p <proxyurl> use this as a proxy
    -P            don't load proxy settings from environment
    -H <header>   send this HTTP header (you can specify several)

    -u            Display method and URL before any response
    -U            Display request headers (implies -u)
    -s            Display response status code
    -S            Display response status chain
    -e            Display response headers
    -d            Do not display content
    -o <format>   Process HTML content in various ways

    -v            Show program version
    -h            Print this message

    -x            Extra debugging output
(23) Failed writing body

  Error: invalid version 0.10.32

While writing this, I just realised that the error message comes from curl head.
Will investigate further.

Here's my environment:
OSX Mountain Lion
NodeJS v0.10.26
curl v7.30.0
head v2.07

node -v
v0.10.26

curl --version
curl 7.30.0 (x86_64-apple-darwin10.0.0) libcurl/7.30.0 OpenSSL/1.0.1e zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP

head -v
This is lwp-request version 2.07 (libwww-perl-5.805)
...

Update 1
n was trying to execute the following command:

$ curl -Is http://nodejs.org/dist/v0.10.32/node-v0.10.32-darwin-x64.tar.gz | head -n 1 | grep 200

Update 2
Found the cause of the problem for my case (TL;DR Wrong head)

When I realised that the error was coming from head, I did a which head and found out it was pointing to a different head

$ which head
/Applications/XAMPP/xamppfiles/bin/head #<--- whaaat

Turns out, in my case, I've installed XAMPP and it has a HEAD executable in its bin folder which was in $PATH and confused the hell out of OSX (not really, it just took the first one it found)

$ echo $PATH
/Applications/XAMPP/xamppfiles/bin:....

Simply edited the $PATH env variable in my profile and hey:

$ which head
/usr/bin/head # yay! my head!

Now sudo n stable works as expected.

Thanks!

@tjwebb

This comment has been minimized.

Show comment Hide comment
@tjwebb

tjwebb Oct 23, 2014

Collaborator

sudo n stable

Also, using sudo can cause your PATH to be different.

Collaborator

tjwebb commented Oct 23, 2014

sudo n stable

Also, using sudo can cause your PATH to be different.

@tjwebb tjwebb closed this Oct 23, 2014

@gshireesh

This comment has been minimized.

Show comment Hide comment
@gshireesh

gshireesh Nov 25, 2017

installing curl fixed problem for me.

gshireesh commented Nov 25, 2017

installing curl fixed problem for me.

@chengjaun

This comment has been minimized.

Show comment Hide comment
@chengjaun

chengjaun May 1, 2018

I have the same problem, follow the answer of installing the curl, but I still get the same error.what can I do

I have the same problem, follow the answer of installing the curl, but I still get the same error.what can I do

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