After clean install with raspbian 2019-06-20, I try to upgrade with
script, then it failed with 'Failed to install Node.js'.
After that, I found new script on /usr/bin/update-nodejs-and-nodered , already installed. Its based with package install.
#!/bin/bash
#
# Copyright 2018 JS Foundation and other contributors, https://js.foundation/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
sudo apt-get update
sudo apt-get -q -y install nodejs npm nodered
nv1=$(npm -v 2>/dev/null)
nv2=$(npm show npm version 2>/dev/null)
if [ "$nv1" != "$nv2" ]; then
echo -e "Installing npm $nv2. Please wait, this can take a while"
sudo npm i -g npm@latest 2>/dev/null
hash -r
nv3=$(npm -v 2>/dev/null)
if [ "$nv3" = "1.4.21" ]; then
echo -e "\nFailed to install latest version of npm - rewinding\n"
sudo apt-get -y purge npm
echo -e "\nnpm uninstalled"
else
echo -e "\nnpm now version $nv3"
fi
else
echo -e "\nnpm now version $nv1"
fi
on Buster, new policy exist with install Node-RED? Is it official?
Just to answer this point, the pre-packaged version of node-red has included this script for a while. This script will update node.js/node-red to whatever is the latest package in the apt repository, and it will install the npm package if it isn't present (which is isn't by default).
It helps a bit with the pre-packaged version, but we still strongly recommend users use the script our documentation points at instead. That gets you a much cleaner setup than the pre-packaged version is able to.
Today after clean install with raspbian 2019-06-20 the error continues for me.
I used:bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)
Actually, not really. I was too quick to post.
I mute my errors with the above solution but node-red still doesn't run, because wrong npm version.
It turns out that was my clock that wasn't syncing, after sync with "sudo ntpd -gq" the script now works, so please forget or delete my post, it's noise.