Installing on Ubuntu?

Hi, I’ve had ionic@beta running on ubuntu for over a week, however recently this stopped working.
I guess it might be since I updated to a higher alpha version of the ionic framework.

However right now as I try to install ionic@beta globally on our jenkins server (Which is Ubuntu) I get the following error.

$ sudo npm install -g ionic@beta
npm http GET
npm http 304
/usr/local/bin/ionic -> /usr/local/lib/node_modules/ionic/bin/ionic

> ionic@2.0.0-beta.17 postinstall /usr/local/lib/node_modules/ionic
> node lib/tasks/postinstall

execSync(cmd, {stdio: [0,1,2]});
TypeError: undefined is not a function
    at Object.<anonymous> (/usr/local/lib/node_modules/ionic/lib/tasks/postinstall.js:9:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read

npm ERR! weird error 8
npm ERR! not ok code 0

I’ve already went over to /usr/bin to make sure node is the same executable as nodejs (Symlink).
Still this error, installing ionic instead of ionic@beta works fine though.

Anyone have a clue what I’m doing wrong?

I’ve updated npm and i get the same issue still (npm latest 2).

npm ERR! ionic@2.0.0-beta.17 postinstall: `node lib/tasks/postinstall`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the ionic@2.0.0-beta.17 postinstall script 'node lib/tasks/postinstall'.
npm ERR! This is most likely a problem with the ionic package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node lib/tasks/postinstall
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ionic
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls ionic
npm ERR! There is likely additional logging output above.

Did you had ionic CLI not beta already installed? then the npm space for ionic could be polluted with ionic 1 CLI, try running this:

npm uninstall -g ionic && npm uninstall -g cordova && npm cache clear && npm cache clean && npm i -g cordova ionic@beta

This should wipe out both cordova and ionic CLI and reinstall from zero.

I resolved my situation by setting up the correct node and npm executable to latest version as well. Did this using nvm and setting this in the jenkins job etc.

1 Like

Hi … I have the same problem when I installed the Ionic beta…Can you help me ? :slightly_smiling:

As mathijsliquix mentioned, using NVM is the easiest solution for getting up and running on ubuntu. In fact, it might also be the only way, as installing node/npm without it on ubuntu can get very hairy. I highly recommend it:

Thank you it worked :grinning:

@mathijsliquix HI i am also facing the same issues please can you provide me step by step installation for ionic@beta after this error occur ( i am also using Ubuntu).

Just check mlewin’s link. It says how you can get to the point. I’m no Ubuntu expert I was just configuring our jenkins server for Angular2