Hello again.
I’m now running across the problem while executing a script with sudo runuser so the script runs as a user on the packer machine.
using amazon-ebs builder, building debian stretch, trying to install nodejs I’m getting this error and the build fails.
==> amazon-ebs: Downloading https://nodejs.org/dist/v8.16.0/node-v8.16.0-linux-
x64.tar.xz...
==> amazon-ebs:
==> amazon-ebs: Computing checksum with sha256sum
==> amazon-ebs: Checksums matched!
amazon-ebs: Now using node v8.16.0 (npm v6.4.1)
==> amazon-ebs: tput: unknown terminal "unknown"
amazon-ebs: Creating default alias: default -> 8.16.0 (-> v8.16.0 *)
amazon-ebs: Now using node v8.16.0 (npm v6.4.1)
==> amazon-ebs: tput: unknown terminal "unknown"
amazon-ebs: default -> 8.16.0 (-> v8.16.0 *)
any ideas how I can solve this?
Many thanks
Can you somehow check the TERMINFO
environment variable? And if it’s not set, try implementing something like export TERMINFO=/usr/lib/terminfo
?
Thank you Tobias,
It was to do with this, I ended up doing the following.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
source ~/.bashrc
source ~/.nvm/nvm.sh
TERM="xterm"
nvm install 8.16.0 && nvm use 8.16.0 && nvm alias default 8.16.0
wait $!
sudo npm install npm@latest -g &>/dev/null
sudo npm install pm2@2.10.4 -g &>/dev/null
the script is using runas --login
for anyone who comes across this post.
I set the TERM var because its not set I think, and also because pm2 outputs some warnings it causes the build to fail because of a non zero exit code.
so for that I’m piping the errors and output to dev/null which solved the issues.
Many thanks
ian