Uninstalling Cordova and Ionic not working - node.js

I am trying to uninstall Cordova and Ionic from my mac. I have run sudo npm uninstall ionic cordova and also with -g however when I run cordova --version or ionic --versions it keeps coming back with version numbers and it all still works normally.
I have checked the directories of both local and global npm install locations and the folders aren't there, when I run the command after the first time it throws an error that it can't find the folders.
I have gone so far as to completely remove NodeJS from my machine but to no avail. Where else is cordova and ionic installed? How do I completely remove them from my machine?

So for some reason, npm uninstall does not deal with the files in the opt directory, found the rougue folders and removed. Problem solved.

Related

MAC: NPM installs modules globally but commands can't be found

Complete MAC noob here but I've been building an iOS version of my app using MacInCloud where I start a Remotebuild from terminal on to the MacInCloud, push to the MacInCloud from Visual Studio on my Windows machine, then open the xcode project on the MacInCloud and finish up the publishing process. So I finally broke down and bought my own Mac and I'm struggling to replace the MacInCloud with my local Mac.
The problem I'm having is I set up my Mac, installed Nodejs (with npm obviously) and then ran:
sudo npm install -g remotebuild
I originally ran without sudo but got the EACCES permission denied error so added sudo. Then ran:
remotebuild
Which gave me
"remotebuild: command not found"
So I verified node:
node -v
v8.11.2
I verified npm:
npm -v
5.6.0
I went to the /.npm-global/lib/node_modules folder and I can literally see the remotebuild folder and files. I've also tried opening a terminal from the bin folder under remotebuild (where the remotebuild executable actually is) and I still get a command not found error.
So then I tested something I'm a little more comfortable with: angular cli. That didn't work either
npm install -g #angular/cli#latest
ng -v
"ng: Command not found"
I've uninstalled and reinstalled Node, I've run the install for remotebuild, I've tried nvm, I'm honestly out of ideas.
Thoughts?
you need to ensure that npms global bin folder is added to your PATH. How you do this may depend on your shell. However you can execute npm bin -g to get the global bin folder of npm.

Installing Ionic - The term 'ionic' is not recognized

I am having trouble installing node.js and npm on my computer. I am running Windows 10 Pro x64, and using Windows Powershell (admin).
I am running node.js 9.10.1 and npm 5.8.0
Here's a screenshot of the error:
As you can see from the screenshot, I installed ionic cordova using the npm install -g ionic cordova command. (I don't know what the difference between that and npm install -g ionic is, though.)
I tried changing the windows PATH -thing, but I'm not sure if I did it correctly. (In the path-environment-variable I added a path to 'C:\Users\Peter\AppData\Local\npm' and one to 'Z:\Program\nodejs' where I installed node.js.)
Try using Roaming instead of Local. I think that installing with -g should go in Roaming.
C:\Users\Peter\AppData\Roaming\npm>

How to completely uninstall Cordova

since I updated my mac to Sierra I noticed a strange behaviour in my cordova app: some plugins aren't working anymore, it just seems they are not copied in the ios platform even if when I add the Platform the plugins' folders are copied as usual. It just seems xcode ignore them.
I tried a few things: removing and adding again plugins, updating cordova, uninstalling and reinstalling cordova, updating platforms, trying creating a brand new app... nothing seems to fix the problem.
Searching around I found this command:
$ cordova platform update ios --save
and it worked without doing anything else.
Unfortunately I have to use this command everytime I make a change in the app and I remove and add the platform again so I guess it's a problem in my environment.
I would like to completely uninstall cordova, node.js and git and reinstall everything again. I found a few instructions like in this question for node.js How do I uninstall nodejs installed from pkg (Mac OS X)? but I don't know how to run correctly all of the commands, some of them fail.
Uninstalling cordova and reinstalling works but doesn't solve the problem.
I did it with
$ sudo npm install -g cordova
$ sudo npm uninstall -g cordova
Can someone link me where to find clear instructions step by step? I'm not that good with command line and I really want to fix this problem without formatting the whole system.
Thank you for any help!
Think I have the solution: I removed cordova,
sudo npm uninstall -g cordova
deleted the .cordova folder in my user home folder (it's a hidden folder!) and installed cordova again with
sudo npm install -g cordova
I noticed that one of my old cordova projects was working: remove platform, add platform and by default I had ios platform version 4.3.0. GOOD!
In another cordova project created after latest update it was still using ios platform 4.2.1.
In the root project folder there is the config.xml file and in this file I found this line in just the second project:
<engine name="ios" spec="~4.2.1" />
Just removed and now cordova is using by default the latest version of the ios platform.
I don't know exactly why in one project there was this line and why not in the other one... neither know if I updated the platform in one project before reinstalling cordova and after reinstalling in onther... can't remember.
I just know that now if I create a new project it's correctly using ios platform 4.3.0 and I tried to describe all my steps...
I hope it will be useful for anyone else because I was ready to format my mac to fix this :(
I don't think you really have a problem with node or npm.
It seems to me more the kind of problem that happen when you change your node version without rebuilding node_modules directory.
If you always install modules with --save modifier, try this:
rm -rf node_modules
npm install
...if not, you can make a backup of your node_modules first. But it will be useful only to inspect it to figure out what modules are missing in your 'package.json' file.

Can't USE any already installed npm packages: Not Recognized

I'm clearly having a misunderstanding about what PATH does. I'm having trouble using any of my installed packages (globally as well as local). What I've tried to do so far:
npm install -g firebase-tools
npm install -g ionic cordova
The packages install just fine. I can see that when I run
npm list -g --depth=0
I get a list that shows the node, cordova, firebase, and ionic packages installed. But, if i want to access any of these packages by running a command, such as
firebase-init
OR
ionic start myApp sidemenu
I get the same error message in my cmd
['firebase']/['ionic'] is not a recognized internal or external command, operable program or batch file.
Nodejs is installed in my Program Files(x86)/nodejs
Here is what i have my PATH variable set to:
C:\Program Files\nodejs;
C:\Program Files (x86)\nodejs\node_modules\npm;
C:\Users\...\myproject\node_modules
I added that last path after locally doing
npm install ionic
where I can clearly see the ionic package in the folder, but I still get the same error as above when I try to run an ionic command.
I'm really disheartened because I've not been able to figure out the issue for weeks now, and I can't get any progress on my project because of it. :(
Note: i'm working on WINDOWS 8
Solution 1: At the application directory, link the local project to the package
npm link firebase-tools
npm link ionic cordova
Solution 2: The problem may be caused by lacking of NODE_PATH definition
Check if NODE_PATH variable is defined in the environment:
echo %NODE_PATH% (for Windows)
echo $NODE_PATH (for Linux)
If not, define it:
setx NODE_PATH C:\Users\<Username>\AppData\Roaming\npm\node_modules (for Windows)
export NODE_PATH=/usr/lib/node_modules (for Linux)
Do you have git installed? Remove it and try out your commands. git causes trouble with paths in windows You can check this answer
#Alexsandra, i would recommmend to install the packages locally:
npm install --save firebase-tools
npm install --save ionic cordova
once installed,check in your project package.json to verify it has been added as one of your dependencies. then type firebase --help
hope that helps!

npm -g adds package to C:\usr\local instead of C:\Users\{User}\AppData\Roaming\npm

I'm trying to working with ionic framework but i get stuck when install ionic via npm
npm install -g ionic
I try $ ionic but it always show "ionic is not recognized as an internal or external command" error.
Then I found that ionic was added into C:\usr\local instead of C:\Users{User}\AppData\Roaming\npm.
I's using Windows 8.1 and I also add C:\Users{User}\AppData\Roaming\npm into PATH and restart machine.
Please help me.
I can temporally fix this issue by copy all folders , files in C:\usr\local instead and paste into C:\Users{User}\AppData\Roaming\npm.
But I still wonder why I get this issue.
Thanks guys.

Resources