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

Created on 25 May 2013  路  9Comments  路  Source: tj/n

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.

Most helpful comment

+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!

All 9 comments

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.

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. .

Is there a solution?

you need to uninstall all other versions of node first.

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

+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!

sudo n stable

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

installing curl fixed problem for me.

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

Was this page helpful?
0 / 5 - 0 ratings