During Vagrant Shell provision I try to install NodeJS and NPM on Debian Wheezy. Script is (from guide https://github.com/joyent/node/wiki/backports.debian.org):
sudo echo "deb http://ftp.us.debian.org/debian wheezy-backports main" >> /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y nodejs-legacy
curl https://npmjs.org/install.sh | sudo sh
Node sets up as a charm, but NPM installation fails:
Stderr from the command:
stdin: is not a tty
dpkg-preconfigure: unable to re-open stdin: No such file or directory
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7810 100 7810 0 0 1407 0 0:00:05 0:00:05 --:--:-- 18956
fetching: http://registry.npmjs.org/npm/-/npm-1.3.15.tgz
npm-install-2877.sh: 270: npm-install-2877.sh: cannot open /dev/tty: No such device or address
Aborted 0.x cleanup. Exiting.
It failed
I've googled about two days - can't find any solution :(
If to set a Vagrant config like this:
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
Then script doesn't say anything about tty, but still fails:
Stderr from the command:
dpkg-preconfigure: unable to re-open stdin: No such file or directory
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7810 100 7810 0 0 1412 0 0:00:05 0:00:05 --:--:-- 19772
fetching: http://registry.npmjs.org/npm/-/npm-1.3.15.tgz
npm-install-3013.sh: 270: npm-install-3013.sh: cannot open /dev/tty: No such device or address
Aborted 0.x cleanup. Exiting.
It failed
The install script tries to access /dev/tty
to ask if it should clean old versions, which apparently doesnt work with gui-less vagrant boxes. You can set this behaviour using the environment variable clean
, too, so it doesnt have to ask:
Change the curl statement to this: curl https://npmjs.org/install.sh | sudo clean=no sh
.
You can use clean=yes
, too, if you prefer.
In case anyone, get the following error after trying curl https://npmjs.org/install.sh
sh: 1: cannot open html: No such file
sh: 2: Syntax error: redirection unexpected
Try to do the following instead:
curl https://www.npmjs.org/install.sh | sudo sh
Apparently, the npm domain needs to use www prefix.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With