Notes to install yarn and upgrade unsupported Node version to V8

Here are my notes to install yarn and upgrade an unsupported Node to v8

The general problem, on bench update or bench start this warning:

11:34:01 watch.1 | warning You are using Node “7.10.0” which is not supported and may encounter bugs or unexpected behavior. Yarn supports the following semver range: “^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0”

Somehow I installed node v0.10.25 and had install yarn but got this CERT_UNTRUSTED error:

frappe@erpnext:~/frappe-bench$ sudo npm install -g yarn
npm http GET https://registry.npmjs.org/yarn
npm http GET https://registry.npmjs.org/yarn
npm http GET https://registry.npmjs.org/yarn
npm ERR! Error: CERT_UNTRUSTED
npm ERR!     at SecurePair.<anonymous> (tls.js:1370:32)
npm ERR!     at SecurePair.EventEmitter.emit (events.js:92:17)
npm ERR!     at SecurePair.maybeInitFinished (tls.js:982:10)
npm ERR!     at CleartextStream.read [as _read] (tls.js:469:13)
npm ERR!     at CleartextStream.Readable.read (_stream_readable.js:320:10)
npm ERR!     at EncryptedStream.write [as _write] (tls.js:366:25)
npm ERR!     at doWrite (_stream_writable.js:223:10)
npm ERR!     at writeOrBuffer (_stream_writable.js:213:5)
npm ERR!     at EncryptedStream.Writable.write (_stream_writable.js:180:11)
npm ERR!     at write (_stream_readable.js:583:24)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>
npm ERR! System Linux 3.13.0-79-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "yarn"
npm ERR! cwd /home/frappe/frappe-bench
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/frappe/frappe-bench/npm-debug.log
npm ERR! not ok code 0

This fixed the above:

frappe@erpnext:~/frappe-bench$ npm config set registry=“http://registry.npmjs.org/

reference: node.js - SSL Error: CERT_UNTRUSTED while using npm command - Stack Overflow

Now install yarn:

frappe@erpnext:~/frappe-bench$ sudo npm install -g yarn
npm http GET http://registry.npmjs.org/yarn
npm http 200 http://registry.npmjs.org/yarn
npm http GET http://registry.npmjs.org/yarn/-/yarn-1.16.0.tgz
npm http 200 http://registry.npmjs.org/yarn/-/yarn-1.16.0.tgz
npm WARN engine yarn@1.16.0: wanted: {"node":">=4.0.0"} (current: {"node":"v0.10.25","npm":"1.3.10"})

frappe@erpnext:~/frappe-bench$ node -v
v0.10.25

Next install Node 8.x with this:

frappe@erpnext:~/frappe-bench$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -

## Installing the NodeSource Node.js 8.x LTS Carbon repo...

## Run `sudo apt-get install -y nodejs` to install Node.js 8.x LTS Carbon and npm
## You may also need development tools to build native addons:
     sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
     curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
     echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
     sudo apt-get update && sudo apt-get install yarn

frappe@erpnext:~/frappe-bench$ sudo apt-get install -y nodejs

frappe@erpnext:~/frappe-bench$ node -v
v8.16.0

And finally run bench setup requirements --node

2 Likes

My .bash_history has this, which is how I recall dealing with old node/yarn.

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn

So right now I have a Ubuntu 16.04 LTS , Node v10.15.3 and Yarn v1.15.2
FWIW

2 Likes

See also Yarn cannot update node, because node is outdated

this article has a good way to upgrade node npm and yarn