3

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

Dawson Loudon
  • 6,029
  • 2
  • 27
  • 31
Alexsandra Guerra
  • 1,625
  • 4
  • 17
  • 19
  • I never got global installs to work properly on Windows. But, then I realized, there really isn't a good reason to use global installs. Make a locally installed version of whatever packages you need and then each app has it's own independent set of packages and if you upgrade something, it only affects the app you want it to affect. So, I just gave up on global installs on Windows and have not missed it one bit. – jfriend00 Apr 21 '15 at 04:30
  • @jfriend00 Yeah, so I did try locally installing it into my project folder, but as I mentioned, it still won't recognize ionic as an internal, external command. – Alexsandra Guerra Apr 21 '15 at 04:54
  • I'm confused. What are you actually trying to run? What's the command line or script line of code that doesn't work? – jfriend00 Apr 21 '15 at 06:13
  • Related: http://stackoverflow.com/questions/29531235/firebase-hosting-set-up-issue – Frank van Puffelen Apr 21 '15 at 14:17
  • There is no `firebase-init` command on the command line. If you're trying to deploy to hosting that would be `npm install -g firebase-tools` and then `firebase init` (with a space and not a dash). The `firebase` npm package is intended for node.js, as in `var Firebase = require('firebase')` inside a node script. – Kato Apr 22 '15 at 20:50
  • Cross-post: https://github.com/firebase/firebase-tools/issues/46 – Frank van Puffelen May 05 '15 at 14:14

3 Answers3

2

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)

Nguyen
  • 2,019
  • 1
  • 24
  • 31
1

Do you have git installed? Remove it and try out your commands. git causes trouble with paths in windows You can check this answer

Community
  • 1
  • 1
Anand
  • 610
  • 6
  • 13
0

@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!