1

After taking the following steps in the command line to install Ember CLI, Firebase, and EmberFire with node, I am getting an error saying that Firebase is not defined in app/adapter/application.js

npm install -g ember-cli

npm install -g bower

npm install -g phantomjs

ember new my-new-app

cd my-new-app

ember server

At this point I can see my ember app with the default output of “Welcome to Ember.js” at localhost:4200

npm install firebase
npm install —save ember-fire
ember generate adapter application

Then in app/adapter/application.js, removed “export default DS.RESTAdapter.extend({});” and pasted "export default DS.FirebaseAdapter.extend({ firebase: new Firebase('https://.firebaseio.com') });” with my own firebase URL

ember server

Then I get an error in terminal:

Serving on http://0.0.0.0:4200

lionworxs/adapters/application.js: line 4, col 17, 'Firebase' is not defined.

1 error

===== 1 JSHint Error

Path or pattern "vendor/firebase/firebase.js" did not match any files
Error: Path or pattern "vendor/firebase/firebase.js" did not match any files

I have tried creating the firebase.js file in the directory specified above, but it leads to an entirely new string of errors so I thought that I missed a step in my installation. Do I need to manually include Firebase somewhere in my application even after "installing" it via command line?

1

2 Answers 2

5

Bower install Firebase and EmberFire.

    bower install firebase --save
    bower install emberfire --save

Be sure you've required the necessary script calls for Firebase and EmberFire in your index.html file:

    <!-- Firebase -->
    <script src="https://cdn.firebase.com/js/client/1.0.19/firebase.js"></script>
    <!-- EmberFire -->
    <script src="https://cdn.firebase.com/libs/emberfire/1.1.3/emberfire.min.js"></script>

In your adapter, try using window.Firebase:

    import DS from 'ember-data';

    export default DS.FirebaseAdapter.extend({
      firebase: new window.Firebase('https://your-firebase-data-url.firebaseio.com/web/data')
    });

Your question is similar to this one - Adding firebase & emberfire dependencies to an ember.js app (ember-cli) ...

And you might find the final comment there helpful - https://stackoverflow.com/a/24541248/409156

Sign up to request clarification or add additional context in comments.

2 Comments

I ran "bower install firebase", added the scripts to the head of my index.html file, and used window.Firebase rather than just Firebase in the adapter, and I now get a build error saying that "vendor/emberfire/dist/emberfire.js" did not match any files. I saw that post before but arrived at basically the same place I am now, any ideas?
bower install emberfire --save
0

I had the same issue as user2817513. Copying this response from another thread because it was the only thing that worked for me:

Posted by tikotzky:

If anyone is still looking for this, I just created an ember-cli addon that include both firebase and emberfire into the app.

All you need to do is run npm install --save-dev ember-cli-emberfire from within your app and you should be good to go.

You can see the code here https://github.com/tikotzky/ember-cli-emberfire

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.