Ionic wont start after npm install ionic - node.js

Im on osx. I had a development with node, npm and ionic. Everything worked.
I accidentally run this command:
npm install -g ionic
After that Ionic is not working anymore. if I try to create a project or start an existing one I got this error:
Caught exception:
Error: Cannot find module 'inherits'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/glob/glob.js:42:14)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
Mind letting us know? https://github.com/driftyco/ionic-cli/issues
npm -v gives:
3.10.8
node -v gives:
v6.4.0
ionic -v
gives the same error message as above.
Im not sure if I installed node/npm with brew or what else. Any ideas?

in my case , uninstalling and reinstalling the ionic worked .
1.npm uninstall -g ionic cordova
2.npm install -g ionic cordova
3.npm update minimatch
4.try reinstalling ionic using ionic#latest

This is because the module 'inherits' is missing which may be a problem with npm.
I'll simply suggest uninstalling and installing again as you may have downloaded corrupt/incomplete files.
On MacOS/Unix:
brew uninstall npm
sudo rm -rf /usr/lib/node_modules/
brew install npm
Then retry installing ionic
npm uninstall -g ionic
npm install -g ionic

Try again by adding “read and write” permission to your project root folder
Like
Ionic is my project root folder and under the ionic folder i have a app named ionicapp

Related

Error: Cannot find module 'commander'

when I m running sails -v, sails lift or even installing npm I m getting this error Please help -
Error: Cannot find module 'commander'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/sails/bin/_commander.js:6:15)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
Most likely commander is missing from package.json. Install it and add it to package.json by doing:
npm install commander --save
Install commander globally.
sudo npm install commander -g
This will install commander module under/usr/lib/node_modules/.
Uninstalling sails and reinstalling with 'sudo' resolved it.
npm uninstall sails -g
sudo npm install sails -g
When i try setup new app with the help of express-generator.
given error:Cannot find module 'commander'
Node version:12.16.1
switch node version :10.16.3
after switch node version is working fine..
In my case it was because of bad version of node. I've tried node 8.15.1 and it works.
On my end, after doing npm install, and attempt to run npm run watch I encountered this same issue of Error: Cannot find module 'commander'.
I did below:
// delete node_modules (can do manually) or command below
// rm -rf node_modules
npm install
And I was able to do npm run watch again.
This maybe because of corrupted packages.

angular cli not working on windows 10

I have just reinstall node.js, npm and angular-cli but this last one does not work on my PC running on Windows 10. The version of node.js is 8.1.2, the version of npm is 5.0.3. I installed angular-cli with the command line npm install -g #angular/cli. Now when I try any command line beginning with ng I have the error:
module.js:487
throw err;
^
Error: Cannot find module '#ngtools/json-schema'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Raphaël\AppData\Roaming\npm\node_modules\#angular\cli\models\config\config.js:6:23)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
Any idea what is wrong?
Shot in the dark, but I heard of -g installs interfering with local angular cli. However, this appears to just be a missing module from the download, maybe just a package lost. Try to uninstall and re-install again
I'm also on Windows 10. Node 8.1.4 and npm 5.2.0
What worked for me was following the steps from an issue thread I found on github: https://github.com/angular/angular-cli/issues/4425
. The link describes the following steps:
Uninstall angular cli
npm uninstall #angular/cli -g
Install rxJS
npm install rxjs -g
Cleared cache
npm cache clean
Manually deleted content in
%AppData%\npm\node_modules
Installed angular cli npm install
#angular/cli -g
Try downgrading node to v7 and npm to v4 then run:
rm -rf node_modules dist
npm cache clear --force
npm install
There are also some threads mentioning the removal of package.lock which is a new part of npm#5. Furhtermore it is worth checking you typescript version ensuring it is > 2.2.0.

Cannot find module 'read' when using ionic start

Trying to get started with ionic and am not able start an app.
When I try ionic start myApp blank it gives the above error, cannot find module 'read'.
aarmora#Breeze:/home/sites$ ionic start taskApp blank
Error: Cannot find module 'read'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/prompt/lib/prompt.js:12:12)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
Cannot find module 'read' (CLI v1.7.14)
Your system information:
Cordova CLI: Not installed
Gulp version: CLI version 3.9.0
Gulp local:
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
OS: Distributor ID: Ubuntu Description: Ubuntu 14.04.3 LTS
Node Version: v4.3.0
When I try to install this package, it looks like it's already installed.
aarmora#Breeze:/home/sites$ sudo npm install -g read
read#1.0.7 /usr/lib/node_modules/read
└── mute-stream#0.0.5
I've uninstalled node, cordova, ionic and reinstalled all of them but it yields the same.
Any ideas?
This is clearly a problem with the installation of ionic. Since you've stated that you've already tried to reinstall ionic and it didn't work, here are two options:
1) Reinstallation with a clean cache
npm cache clean
npm uninstall ionic -g
npm install ionic -g
2) If the previous one didn't work, let's get a little more hacky
cd /usr/local/lib/node_modules/ionic
npm install read
For both options, according to your machine config, you might have to sudo.

Ionic installation after Ionic2 installation

I tried to install Ionic2 with no success, so I decided to go back to Ionic but during the process something went bad and I can't re-installl the ionic and cordova.
after sudo npm install -g cordova ionic, I tried to run ionic and got:
xx#xxx:~/dev$ ionic info
module.js:328
throw err;
^
Error: Cannot find module 'xmlbuilder'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/xml2js/lib/xml2js.js:12:13)
at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/xml2js/lib/xml2js.js:436:4)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
my versions are:
xx#xxx:~/dev$ npm -v
2.14.12
gal#xxx:~/dev$ nodejs -v
v0.10.25
xx#xxx:~/dev$ node -v
v4.2.6
I also encountered that issue. What I did was:
$ cd /usr/local/lib/node_modules/ionic/
$ npm install xmlbuilder
You may also use sudo
It just happens that xmlbuilder is a dependency of xml2js and cannot load the module because it wasn't included in the ionic's package.json of the upon installing ionic.
What worked for me was to use
sudo npm install -g ionic#beta cordova
to install the V2 version according to link.
Cleaning the npm cache helped in my case. The actions required were:
Install a stable version of nodejs depending of your OS follow these instructions.
Remove all installed versions of cordova and ionic:
sudo npm uninstall -g ionic cordova bower
Critically, clean the npm cache:
npm cache clean
Install from scratch:
sudo npm install bower cordova ionic -g
NOTE: Do not install nodejs version from Ubuntu 14.04 LTS repository because is outdated.
Have you tried to
sudo npm uninstall -g ionic
sudo npm install -g ionic
I faced similar issues while downloading ionic 2. Try to install node version 4.2.3 and cordova version 5.4.1 first and then install ionic
For ionic v2, npm install -g ionic#beta
For ionic v1, npm install -g ionic
You should check your version of nodejs. Make sure that it's version 4. If not, uninstall nodejs and install ver 4.
Goodluck!
P/s:
Uninstall:
sudo apt-get remove nodejs
Install:
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

Nodejs and npm error. modules missing

module.js:340
throw err;
^
Error: Cannot find module 'vinyl'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/morpheyesh/debugall/web-starter-kit/node_modules/gulp/node_modules/gulp-util/lib/File.js:1:80)
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 Module.require (module.js:364:17)
I have major issues with node.js. I try to run any nodejs application or gulp, i get this error, I try to install every module , I keep getting the same error and it requires a new module. Is there anyway where I can install all the modules?
Plus, I have install nodejs through npm? how to install system wide? Gulp is been installed system wide(global). What is causing this error?
nodejs -v gives v0.10.30
`npm -v gives 1.4.21
gulp 3.8.7
I am working with the google web starter kit. I installed nodejs using apt-get, then install sass, then installed gulp, then npm. Is there a way where I can remove all these and install all of it system wide?
Try updating your global gulp installation:
sudo npm install --global gulp#latest
It sounds like everything is (was?) FUBAR for a while there. If you have not yet solved these problems, here's what I would recommend.
First, the official (Debian/Ubuntu) packages are a bit behind latest node. I would recommend uninstalling the packages nodejs and nodejs-legacy and following the instructions here to get the latest versions (packaged and published by nodesource): https://github.com/nodesource/distributions#usage-instructions
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
Now you will have a recent node (0.10.35) but an out-of-date npm. Upgrade your npm:
npm install -g npm#latest
Things should now work for you; you should be able to run npm install in your project directory and all dependencies will be installed correctly.
One thing to be wary of is that you should never run npm update or npm update -g. This does not update the current (or all global) packages, as one might think.
Try this for install all plugins required by gulp :
npm install gulp-jshint gulp-sass gulp-concat gulp-uglify gulp-rename --save-dev
Source : http://travismaynard.com/writing/getting-started-with-gulp
For me uninstalling gulp and then reinstalling it worked fine. This is with node v5.0.0
sudo npm uninstall -g gulp
npm install -g gulp

Resources