在提供期间,不能在stream浪汉上安装NPM

在Vagrant Shell规定期间,我尝试在Debian Wheezy上安装NodeJS和NPM。 脚本是(从指南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 

节点设置为魅力,但NPM安装失败:

斯德哥尔从命令:

 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 

我google了大约两天 – 找不到任何解决scheme:(

UPD

如果要设置一个像这样的Vagrantconfiguration:

 config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" 

然后脚本没有说任何关于tty,但仍然失败:

 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 

安装脚本试图访问/dev/tty ,询问是否应该清理旧版本,这显然不支持gui-lessstream浪盒。 你也可以使用环境variablesclean来设置这个行为,所以它不必问:

将curl语句更改为: curl https://npmjs.org/install.sh | sudo clean=no sh curl https://npmjs.org/install.sh | sudo clean=no sh

如果您愿意,也可以使用clean=yes

在任何情况下,尝试curl https://npmjs.org/install.sh后得到以下错误

 sh: 1: cannot open html: No such file sh: 2: Syntax error: redirection unexpected 

尝试做,而不是:

 curl https://www.npmjs.org/install.sh | sudo sh 

显然,npm域需要使用www前缀。