Unable to make Ionic work in Ubuntu 14.04


#1

I followed a few guides available online to install Ionic in Ubuntu 14.04 LTS. I could go as far as using the command

ionic start myApp1 blank

but it throws an error everytime. I checked with nodejs team. They seem to believe it has something to do with setting up framework. The following is the error I get

`$ ionic start myApp1 blank
module.js:341
    throw err;
    ^

Error: Cannot find module 'archiver'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/utils.js:3:16)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)

Plese help me fix it


A guide to install Ionic 2 in Ubuntu 14.04
#2

Someone, please reply.


#3

What were the steps you did to install? What version does it say of ionic and ionic cli does your system say you have installed?


#4

Thanks for the reply @polska03

I just typed

$ ionic -v

It too gave the same error

I already had Android studio installed. So I just used the rest of the commands from this guide

http://samhassell.com/getting-ionic-framework-up-and-running-on-ubuntu-14-04/


#5

The node version referenced in that page is ancient. Try using nvm to install 4.4.3 and then try using npm to install ionic again.


#6

Thanks you @rapropos

Can you give the command to do the same as well please ?


#7

I used

sudo apt-get remove --purge nodejs npm

to remove current nodejs and npm and then tried

    curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -

    sudo apt-get install nodejs

But when I try the following command ( after reinstalling corodova and ionic )

ionic -v

I get this error

$ ionic -v
module.js:327
    throw err;
    ^

Error: Cannot find module 'archiver'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/utils.js:3:16)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)

What to do ?

PS : I used this guide


Error: Cannot find module 'archiver'
#8

I don’t use Ubuntu, so I can’t comment on how their packaged versions of node work. If somebody else can help you there, that would be great, but if you would like to try an alternative (which doesn’t need root privileges and stores everything inside your user directory), I have had good luck with nvm.


#9

@rapropos

I have installed nvm, what to do next ?

As of now, it says

You currently have modules installed globally withnpm. These will no => longer be linked to the active version of Node when you install a new node => withnvm; and they may (depending on how you construct your$PATH) => override the binaries of modules installed withnvm`:

/usr/lib
β”œβ”€β”€ bower@1.7.9
β”œβ”€β”€ cordova@6.1.1
β”œβ”€β”€ grunt-cli@1.1.0
β”œβ”€β”€ gulp@3.9.1
β”œβ”€β”€ gulp-util@3.0.7
β”œβ”€β”€ ionic@1.7.14

=> If you wish to uninstall them at a later point (or re-install them under your
=> nvm Nodes), you can remove them from the system Node as follows:

 $ nvm use system
 $ npm uninstall -g a_module

=> Close and reopen your terminal to start using nvm

`


#10

Some help will be appreciated.