Ionic command line bug? Linux is looking for `node`

I managed to have some problems with my computer which made it so I had to install an old copy of Ubuntu Server 14.04 as my main operating system and configure a desktop environment. (Sounds easy, but dear god my computer has some problems.)

Luckily I was able to restore my project files for my application, considering I’m getting ready for production.

However I’m having a problem getting the Cordova / Ionic command line to work.

administrator@master-server:~/qualify/production⟫ ionic
/usr/bin/env: node: No such file or directory

I have installed nodejs through the universal repositories, as-well as npm with the following commands

sudo apt-get install nodejs
sudo apt-get install npm

I then installed cordova and ionic.

sudo npm install -g cordova ionic

Both installations completed successfully.

Based on the error “node: no such file or directory” i believe that ionic command line is looking for node instead of nodejs however, node doesn’t seem to have anything to do with nodejs.

The following packages were automatically installed and are no longer required:
  ax25-node folks-common gir1.2-accountsservice-1.0 gir1.2-atspi-2.0
  gir1.2-caribou-1.0 gir1.2-clutter-1.0 gir1.2-cogl-1.0 gir1.2-coglpango-1.0
  gir1.2-gck-1 gir1.2-gcr-3 gir1.2-gdesktopenums-3.0 gir1.2-gdm-1.0
  gir1.2-gmenu-3.0 gir1.2-gnomedesktop-3.0 gir1.2-json-1.0 gir1.2-mutter-3.0
  gir1.2-networkmanager-1.0 gir1.2-nmgtk-1.0 gir1.2-polkit-1.0
  gir1.2-telepathyglib-0.12 gir1.2-telepathylogger-0.2 gir1.2-upowerglib-1.0
  gjs gnome-accessibility-themes gnome-contacts gnome-shell-common
  gnome-themes-standard gnome-themes-standard-data gtk2-engines-pixbuf libax25
  libcaribou-common libcaribou0 libdee-1.0-4 libfolks-eds25
  libfolks-telepathy25 libfolks25 libgdm1 libgee-0.8-2 libgjs0e
  libgnome-menu-3-0 libmbim-glib0 libmozjs-24-0 libmutter0d libopenvg1-mesa
  libqmi-glib0 libzeitgeist-2.0-0 mutter-common openbsd-inetd python-zeitgeist
  usb-modeswitch usb-modeswitch-data zeitgeist zeitgeist-core
  zeitgeist-datahub

I should probably add that installing the node package does remove the error about not being able to find node, however no functionality is executed. No information is presented, and no progress was made. I had then removed node with

sudo apt-get remove --purge node

The node binary is not on your $PATH.

Try this in case node is installed in a wrong dir:

ln -s /usr/bin/nodejs /usr/bin/node

or remove nodejs and add:

sudo apt-get install nodejs-legacy

Why so many people or tutorials install node as sudo?
Use nvm or nodenv, you’ll have less problems.

Force of habit :smile:

Yes it happens to me also :wink: and also on Wnidows I haven’t found a nvm equivalent that works fine.

1 Like

if there is no need to handle multiple node versions on one system you need no nvm :wink:

if you are working with projekt-dependend nodeversions i prefer to use docker/ docker-compose or something similar. so you have your whole development environment separated.

1 Like

Because I require sudo permissions to install anything on my machine, or to perform any type of r/w actions. It’s just how I have it configured.

NOTE: Ionic does not work with nodejs-legacy