Factsheet
Videos
Okey, I finaly found how to do it
I just needed to add
build-snaps:
- node/12/stable
in the electron-helloworld part
( note that I have others problem after that, but it's an other subject )
You are right, the nodejs runtime in the snap packages is quite outdated even when using core18 as base via base: core18 in the snapcraft.yaml.
The solution is not using the snapcraft nodejs plugin but to download the provided binaries directly from the nodejs distributions archive: https://nodejs.org/dist/.
This can be made very conveniently via snapcrafts dump plugin which supports downloading and extracting archives (even the efficient xy compression) with only one line of code: To get the newest nodejs version of 12.18.x for 64 bit (AMD) linux this parts definition gets it into the snap:
parts:
node:
plugin: dump
source: https://nodejs.org/dist/v12.18.4/node-v12.18.4-linux-x64.tar.xz
Nodejs will than be available in the snaps bin directory. The command for starting a javascript app can than look like:
command: bin/node $SNAP/app/index.js
Simply follow the instructions given here:
Example install:
sudo apt-get install python-software-properties python g++ make sudo add-apt-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get install nodejsIt installs current stable Node on the current stable Ubuntu. Quantal (12.10) users may need to install the software-properties-common package for the
add-apt-repositorycommand to work:sudo apt-get install software-properties-commonAs of Node.js v0.10.0, the nodejs package from Chris Lea's repo includes both npm and nodejs-dev.
Don't give sudo apt-get install nodejs npm. Just sudo apt-get install nodejs.
As of today, you can simply install it with:
sudo apt-get install nodejs
Per the Node.js website:
# Using Debian/Ubuntu
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
Then, you will have the latest version of Node.js.
If you're not a fan of curl <url> | bash -, or are using an unsupported distribution, you can try a manual installation.
Node is one of the easier projects to build. Just change the version as that continues to change.
Browse to http://nodejs.org/dist/latest/ to find out the latest package version.
cd /usr/local/src
wget http://nodejs.org/dist/latest/node-v7.2.1.tar.gz
tar -xvzf node-v7.2.1.tar.gz
cd node-v7.2.1
./configure
make
sudo make install
which node
You should see /usr/local/bin/node.
» npm install node-snapd