node-pi-zero icon indicating copy to clipboard operation
node-pi-zero copied to clipboard

how to downgrade npm 6.14.8 to be compatible w/ node 8.10

Open thesoulpole opened this issue 3 years ago • 3 comments

Hi, I upgraded (foolishly) npm from 5.6.0 (which I had from installing node 8.10, which I need for a software package) to 6.14.8. Now it will not run, to downgrade. I get this: (even with version switch I get the same):

pi@raspberrypi:~/kettlerUSB2BLE $ npm install [email protected] npm does not support Node.js v8.10.0 You should probably upgrade to a newer version of node as we can't make any promises that npm will work with this version. You can find the latest version at https://nodejs.org/ /opt/nodejs/lib/node_modules/npm/lib/npm.js:32 #unloaded = false ^

SyntaxError: Invalid or unexpected token at createScript (vm.js:80:10) at Object.runInThisContext (vm.js:139:10) at Module._compile (module.js:616:28) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at module.exports (/opt/nodejs/lib/node_modules/npm/lib/cli.js:22:15)

thesoulpole avatar Jan 19 '22 19:01 thesoulpole

you need to uninstall the current version first, then reinstall the old node

# This line will clear existing nodejs
sudo rm -rf /opt/nodejs;
# Remove existing symlinks
sudo unlink /usr/bin/node;
sudo unlink /usr/sbin/node;
sudo unlink /sbin/node;
sudo unlink /usr/local/bin/node;
sudo unlink /usr/bin/npm;
sudo unlink /usr/sbin/npm;
sudo unlink /sbin/npm;
sudo unlink /usr/local/bin/npm;
sudo unlink /usr/bin/npx;
sudo unlink /usr/sbin/npx;
sudo unlink /sbin/npx;
sudo unlink /usr/local/bin/npx;

si458 avatar Jan 19 '22 19:01 si458

so just installing the 8.10 version (using the command $ wget -O - https://raw.githubusercontent.com/sdesalas/node-pi-zero/master/install-node-v8.10.0.sh | bash) will not do it? I need to do the rm, unlinks first?

thesoulpole avatar Jan 19 '22 20:01 thesoulpole

so just installing the 8.10 version (using the command $ wget -O - https://raw.githubusercontent.com/sdesalas/node-pi-zero/master/install-node-v8.10.0.sh | bash) will not do it? I need to do the rm, unlinks first?

in theory the scripts already have the uninstall commands in them so you could just run the script again in theory

si458 avatar Jan 19 '22 20:01 si458