I just started a ionic 2 project with typescript, and im getting both theses errors:
ERROR in [default] /Users/rodrigoreal/Projects/rodrigo/myproject/app/app.ts:25:18
Cannot find name 'Firebase'.
ERROR in [default] /Users/rodrigoreal/Projects/rodrigo/myproject/node_modules/angular2/src/facade/promise.d.ts:1:9
Cannot re-export name that is not defined in the module.
In my index.html <script src="lib/firebase/firebase.js"></script>
To fix the first error you have to install the Firebase definitions - run this command:
typings install firebase --ambient --save
NOTE: If you don’t have typings installed then you have to install it first:
npm install typings -g
The second error is caused by incompatibility between TypeScript and Angular (see angular issue #6468, tl;dr: TypeScript 1.8 requires angular2 beta.7 or higher). Check in your package.json file which version of TypeScript is used (most probably 1.8+). This error will be resolved with the next Ionic2 release (beta.4) because the master is already updated to Angular2 beta.8.
If you already have project(s) started with an earlier release of Ionic 2 then you’ll have to update the project(s) as well (check the linked post for more details):
In such case, keep in mind that depending on how old release of Ionic 2 the project is using, you may hit a few (or many) breaking changes.
then run the above command, it will only update the Ionic CLI Version which is used to run the ionic commands i.e. ionic start, ionic serve, etc.
If you want to update your version of the framework, you can modify the package.json where it says ionic-angular to the version you want, and then run npm install in the project directory:
typings ERR! deprecated The "ambient" flag is deprecated. Please use "global" instead
and running with global gives:
[cos@localhost app1]$ typings install firebase --global --save
typings ERR! message Attempted to compile "firebase" as a global module, but it looks like an external module. You'll need to remove the global option to continue.
typings ERR! cwd /home/cos/app1
typings ERR! system Linux 3.10.0-327.el7.x86_64
typings ERR! command "/home/cos/.nvm/versions/node/v6.3.1/bin/node" "/home/cos/.nvm/versions/node/v6.3.1/bin/typings" "install" "firebase" "--global" "--save"
typings ERR! node -v v6.3.1
typings ERR! typings -v 1.3.2
typings ERR! If you need help, you may report this error at:
typings ERR! <https://github.com/typings/typings/issues>
I will try without the global option but shudder to think of the repercussions down the road for such a daring venture (on another note…after a long enduring struggle with node and permissions - why dont you guys offer NOOBs the suggestion to install nvm instead of the ridiculous way node installs ? - had this struggle with node while playing around with docker too)
Hi I am new to Ionic2, (and Ionic in general), and i am facing the same issue, i run the command npm install typings -g
and the other one typings install firebase --save but still getting the same error Cannot find name 'firebase' i did those things under my working folder, is there something i can do to get a workaround or did i miss something there?
You might be running typings 1.0, which introduced some breaking changes. Try: $ typings install dt~firebase --global --save
You may also need to update your tsconfig.json from … to …
Hi, i’m just adding firebase through the js method on their site (adding the code to the index.html). I’ve tried updating the typings as stated on the typings git but am still getting TS2304 errors:
app/login/login.component.ts(26,9): error TS2304: Cannot find name 'firebase'.
app/login/login.component.ts(51,9): error TS2304: Cannot find name 'firebase'.
app/login/login.component.ts(60,13): error TS2304: Cannot find name 'firebase'.
app/login/login.component.ts(63,56): error TS2304: Cannot find name 'firebase'.
app/app.component.ts(16,9): error TS2304: Cannot find name 'firebase'.
It also underlines each call refernece to firebase in my components. Do i need to import firebase in my components??
Thanks
It’s hard to say without seeing your code and knowing which version of Firebase are you using, therefore I’ll recommend you to check out the following resources:
I don’t think recommending people edit things under node_modules is a good idea. npm will blow away your changes time and again. This thread is also pretty irrelevant since ionic-native >=2.3.0 which added a Firebase plugin.