Installing Electron under Ubuntu – “node: not found”

I was trying to install Electron on Ubuntu using this command:

npm install electron-prebuilt -g

It would run for awhile, then fail with this error:

sh: 1: node: not found

Several online sources said to install “node-legacy”, but this never worked:

sudo apt-get install node-legacy
Reading package lists… Done
Building dependency tree Reading state information… Done
E: Unable to locate package node-legacy

Searching the apt cache revealed something:

sudo apt-cache search legacy | grep node
node-dompurify – XSS sanitizer for HTML, MathML and SVG – Node.js module
node-es5-shim – ECMAScript 5 compat. shims for old JavaScript engines (Node.js)
node-es6-shim – ECMAScript 6 compat. shims for legacy JavaScript engines (Node.js)
nodejs-legacy – evented I/O for V8 javascript (legacy symlink)

The package is nodejs-legacy, not node-legacy! Installing nodejs-legacy solved the problem, and Electron installed cleanly after that.

sudo apt-get install nodejs-legacy

About Jeff Fitzsimons

Jeff Fitzsimons is a software engineer in the California Bay Area. Technical specialties include C++, Win32, and multithreading. Personal interests include rock climbing, cycling, motorcycles, and photography.
This entry was posted in Electron, Technology. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *