Cannot run on Ubuntu 12.10 #106

fanweixiao opened this Issue Mar 15, 2013 · 9 comments


None yet

8 participants

cc@cchp:n(master)$ node -v
cc@cchp:n(master)$ npm -v
cc@cchp:n(master)$ n


  ο 0.8.20 

/usr/local/bin/n: 177: read: Illegal option -s

/usr/local/bin/n: 244: /usr/local/bin/n: cannot create /usr/local/n/versions/.prev: Is a directory
cp: cannot stat `/usr/local/n/versions/0.8.20/*': No such file or directory

I changed sh to bash to solve Illegal option -s issue. but I don't know how to solve error n:244


This also occured on my Ubuntu machine(12.04). And I found the cause of it.
Because ubuntu's sh is not bash. It's dash.
dash's read command doesn't support -s option.

If it's needed I'll write a patch for this.


I have slightly different case. Maybe also difference in shell application:

$ sudo n 0.9.0

    install : 0.9.0

Error: invalid version 0.9.0

That's not related to this issue.
Your error is just 404.

See these directories. v0.9.0 lacks some archives.



Maybe then worth to add to output in this case, because it is not obvious what happened.
However, it worked with another version (0.9.3) as a charm, thanks for your info.



root@ubuntu-dev:~/node-v0.8.22# n

  ο 0.8.22

/usr/local/bin/n: 177: read: Illegal option -s
root@ubuntu-dev:~/node-v0.8.22# uname -a
Linux ubuntu-dev 3.5.0-25-generic #39~precise1-Ubuntu SMP Tue Feb 26 00:07:14 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
root@ubuntu-dev:~/node-v0.8.22# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.2 LTS
Release:    12.04
Codename:   precise


Same deal on saucy (13.10)


In later versions of Ubuntu, sh is dash, not bash. Workaround is to change the hashbang:

#!/usr/bin/env bash
@medimatrix medimatrix added a commit that referenced this issue Jan 30, 2014
@medimatrix medimatrix Make n use bash
On some systems, the default shell is not bash. This commit fixes issue #106

This issue has now been resolved as my pull request has been merged.

tj commented Jan 31, 2014

should have fixed this a long time ago sorry about that :D thanks for the reminder @medimatrix

@tj tj closed this Jan 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment