Update issues in AngularFire 5.0 - angularfire2

I am working on a Angular 2 app which stores the purchase details of user's in firebase. I'm using AngularFire2 for interacting with firebase.
The project was working fine until I updated the angularfire2 library. It is mentioned on their github repo that they have made some breaking changes in AngularFire 5.0.
I tried to update my function calls as mentioned in their documentation.
Still I'm getting the following error.
ERROR in /Users/manu/Desktop/Bitbucket-2017-repo/angular4-portal/node_modules/angularfire2/database/firebase_list_observable.d.ts (16,92): Namespace 'firebase' has no exported member 'Promise'.
My package.json file is:
{
"name": "angular4-portal",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^4.2.4",
"#angular/common": "^4.2.4",
"#angular/compiler": "^4.2.4",
"#angular/core": "^4.2.4",
"#angular/forms": "^4.2.4",
"#angular/http": "^4.2.4",
"#angular/platform-browser": "^4.2.4",
"#angular/platform-browser-dynamic": "^4.2.4",
"#angular/router": "^4.2.4",
"#ng-bootstrap/ng-bootstrap": "^1.0.0-beta.5",
"angularfire2": "^4.0.0-rc0",
"core-js": "^2.4.1",
"firebase": "^4.5.0",
"ngx-bootstrap": "^2.0.0-beta.5",
"rxjs": "^5.4.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"#angular/cli": "^1.4.4",
"#angular/compiler-cli": "^4.2.4",
"#angular/language-service": "^4.2.4",
"#types/jasmine": "~2.5.53",
"#types/jasminewd2": "~2.0.2",
"#types/node": "~6.0.60",
"codelyzer": "~3.1.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.3.2",
"typescript": "^2.3.4"
}
}

I had the same issue and just solved it by updating as well the angularfire2.
you are still at version 4.0.0.rc0 (I was rc2).
I've updated to latest version 5.0.0-rc.1 and all errors were gone.
run :
npm uninstall angularfire2
then :
npm install angularfire2 --save

I had the same problem and it was fixed checked the app.module.ts IMPORTS.
Can you show me your app.module.ts file?

Maybee try downgrade to
"angularfire2": "^4.0.0-rc.0",
"firebase": "^3.9.0"
in package.json - this is worked for me in my project.

Related

How to build bundle.js with angular 8?

Anybody can help me?
How to build only one bundle.js with angular 8 ? Lots of javascript files were created when I executed "npm run build". (e.g main.js/runtime.js/polyfills.js/...)
I hope that all of them(main.js/runtime.js/polyfills.js/) can output to bundle.js
Here is my packages.json:
{
"name": "buy-me",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod --aot --build-optimizer --base-href /buyme/ --deploy-url /buyme/",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular-devkit/core": "^8.0.1",
"#angular/animations": "^8.0.0",
"#angular/common": "^8.0.0",
"#angular/compiler": "^8.0.0",
"#angular/core": "^8.0.0",
"#angular/forms": "^8.0.0",
"#angular/platform-browser": "^8.0.0",
"#angular/platform-browser-dynamic": "^8.0.0",
"#angular/router": "^8.0.0",
"core-js": "^3.1.3",
"ngx-markdown": "^8.0.1",
"rxjs": "^6.5.2",
"rxjs-compat": "^6.5.2",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular-devkit/build-angular": "^0.800.1",
"#angular/cli": "^8.0.1",
"#angular/compiler-cli": "^8.0.0",
"#angular/language-service": "^8.0.0",
"#types/jasmine": "~3.3.13",
"#types/jasminewd2": "~2.0.6",
"#types/node": "~12.0.4",
"codelyzer": "^5.0.1",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~2.0.0",
"karma-coverage-istanbul-reporter": "^2.0.5",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.2",
"ts-node": "~8.2.0",
"tslint": "~5.17.0",
"typescript": "^3.4.5"
}
}
I tried but output files like main.js, polyfills.js, runtime.js and so on, I hope that these can be concat one bundle.js.
With Angular 8 you don't have to bundle those files together. But if you want, the following steps will help you with that:
Install concat package into your project
Add the following lines to your package.json's "scripts" section:
"concat:es-5": "concat -o ./dist/ng-test-proj/bundle-es5.js ./dist/ng-test-proj/main-es5.*.js ./dist/ng-test-proj/polyfills-es5.*.js ./dist/ng-test-proj/runtime-es5.*.js",
"concat:es-2015": "concat -o ./dist/ng-test-proj/bundle-2015.js ./dist/ng-test-proj/main-es2015.*.js ./dist/ng-test-proj/polyfills-es2015.*.js ./dist/ng-test-proj/runtime-es2015.*.js",
"build:prod": "ng build -c production",
"build:prod:bundle": "npm run build:prod && npm run concat:es-5 && npm run concat:es-2015",
Now you can execute "npm run build:prod:bundle" in a terminal and you will get two bundle files.
As a last step, your HTML file should be updated (it should has links to those bundles if you want to use them instead of original files).

How can I solve this error \%RESOURCE_DIR%\?

package.json Angular6:
{
"name": "adnanrealestate",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#agm/core": "^1.0.0-beta.3",
"#angular-mdc/web": "^0.36.3",
"#angular/animation": "^4.0.0-beta.8",
"#angular/animations": "^6.0.7",
"#angular/cdk": "github:angular/cdk-builds",
"#angular/common": "^6.0.7",
"#angular/compiler": "^6.0.7",
"#angular/core": "^6.0.7",
"#angular/forms": "^6.0.7",
"#angular/http": "^6.0.7",
"#angular/material": "github:angular/material2-builds",
"#angular/platform-browser": "^6.0.7",
"#angular/platform-browser-dynamic": "^6.0.7",
"#angular/platform-server": "^6.1.7",
"#angular/router": "^6.0.7",
"#google-cloud/firestore": "^0.16.1",
"#ng-bootstrap/ng-bootstrap": "^2.1.2",
"#ng-bootstrap/schematics": "^2.0.0-alpha.1",
"#ngrx/store": "^2.2.3",
"#ngui/map": "^0.30.3",
"#ngx-translate/core": "^10.0.2",
"#ngx-translate/http-loader": "^3.0.1",
"#types/googlemaps": "^3.30.10",
"angular-captcha": "^3.4.0",
"angular-file-upload": "^2.5.0",
"angular-file-uploader": "^4.1.1",
"angular-font-awesome": "^3.1.2",
"angularfire2": "^5.0.0-rc.12-next",
"bootstrap": "^4.1.1",
"core-js": "^2.5.4",
"file-saver": "^1.3.8",
"filepond": "^1.8.6",
"firebase": "^5.2.0",
"firebase-admin": "^5.12.1",
"firebase-functions": "^1.1.0",
"firestore": "^1.1.6",
"font-awesome": "^4.7.0",
"fs": "0.0.1-security",
"hammerjs": "^2.0.8",
"json2typescript": "^1.0.6",
"linq2fire": "^1.0.18",
"ng-bootstrap-form-validation": "^3.0.3",
"ng-recaptcha": "^4.0.0",
"ng-slideshow": "^0.8.2",
"ngx-bootstrap": "^3.0.1",
"ngx-gallery": "^5.6.2",
"ngx-international-phone-number": "^0.1.3",
"ngx-intl-tel-input": "^1.0.6",
"ngx-order-pipe": "^2.0.1",
"ngx-pagination": "^3.2.0",
"ngx-popover": "0.0.16",
"rxjs": "^6.0.0",
"rxjs-compat": "^6.2.1",
"time-ago-pipe": "^1.3.2",
"uikit": "^3.0.0-rc.6",
"zone.js": "^0.8.26"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.6.8",
"#angular/cli": "^6.2.1",
"#angular/compiler-cli": "^6.0.7",
"#angular/language-service": "^6.0.7",
"#types/hammerjs": "^2.0.35",
"#types/jasmine": "~2.8.6",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.3.0",
"ts-node": "^5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2"
}
package.json firebase-functions
{
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "tsc",
"serve": "npm run build && firebase serve --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"main": "lib/index.js",
"dependencies": {
"firebase-admin": "^6.0.0",
"firebase-functions": "^2.0.5"
},
"devDependencies": {
"tslint": "~5.8.0",
"typescript": "~2.8.3"
},
"private": true
}
\%RESOURCE_DIR%\ image
How can I fix this error?
and after a change to $ same error
I use npm install for angular 6 and for firebase functions, I didn't see any difference.
please help this is a bad error I don't know where is error specifically of version or other.
https://github.com/firebase/firebase-tools/issues/610
I solved this problem, It's very easy. You don't need to uninstall.
Step1: open firebase.json
you will show this JSON file
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
]
}
Step2: Delete "npm --prefix \"$RESOURCE_DIR\" run lint", and "npm --prefix \"$RESOURCE_DIR\" run build"
"functions": {
"predeploy": [
]
}
Step3: firebase deploy --only functions.
Step4: Like and share my solved.

Angular 2: Visual Code Studio Terminal Not Loading Automatically

When you have changes and you save it, terminal loads and says
webpack: Compiled successfully.
But lately in my VSC, it doesn't load automatically anymore. I still have to Command C and ng serve a project again and again to see changes on the localhost
package.json
{
"name": "gms",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"sw": "sw-precache --root=dist --config=sw-precache-config.js",
"static-serve": "cd dist && live-server --port=4200 --host=localhost --entry-file=/index.html"
},
"private": true,
"dependencies": {
"#angular/common": "^4.0.0",
"#angular/compiler": "^4.0.0",
"#angular/core": "^4.0.0",
"#angular/forms": "^4.0.0",
"#angular/http": "^4.0.0",
"#angular/platform-browser": "^4.0.0",
"#angular/platform-browser-dynamic": "^4.0.0",
"#angular/router": "^4.0.0",
"core-js": "^2.4.1",
"jquery": "^3.2.1",
"ng2-validation": "^4.2.0",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"#angular/cli": "1.0.0",
"#angular/compiler-cli": "^4.0.0",
"#types/jasmine": "2.5.38",
"#types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.0",
"sw-precache": "^5.1.1",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0"
}
}

Cannot get MEAN app deployed to Heroku because of “ No default language could be detected for this app.”

I am trying to deploy a MEAN app to Heroku, but cannot push due to the following error:
! No default language could be detected for this app.
HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
See https://devcenter.heroku.com/articles/buildpacks
! Push failed
I tried setting a node.js buildpack with their latest node buildpack release, but just received another error:
failed to detect buildpack
This is my first deployment to Heroku, so I'm brand new at this.
Here are my package.jsons:
Server
{
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"bcrypt": "^1.0.2",
"body-parser": "^1.16.1",
"cookie-parser": "^1.4.3",
"cors": "^2.8.2",
"debug": "^2.6.3",
"ejs": "~2.5.5",
"express": "^4.14.1",
"jsonwebtoken": "^7.3.0",
"mongoose": "^4.9.2",
"morgan": "^1.7.0",
"multer": "^1.3.0",
"passport": "^0.3.2",
"passport-jwt": "^2.2.1",
"request": "^2.81.0",
"request-promise": "^4.2.0",
"serve-favicon": "^2.3.2"
}
}
Client
{
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/common": "^2.4.0",
"#angular/compiler": "^2.4.0",
"#angular/core": "^2.4.0",
"#angular/forms": "^2.4.0",
"#angular/http": "^2.4.0",
"#angular/platform-browser": "^2.4.0",
"#angular/platform-browser-dynamic": "^2.4.0",
"#angular/router": "^3.4.0",
"#types/googlemaps": "^3.26.8",
"#types/jquery": "^2.0.43",
"#types/lodash": "^4.14.62",
"#types/underscore": "^1.8.0",
"amcharts3-angular2": "github:amcharts/amcharts3-angular2",
"angular2-google-maps": "^0.17.0",
"core-js": "^2.4.1",
"dotenv": "^4.0.0",
"jquery": "^3.2.1",
"lodash": "^4.17.4",
"ng2-google-charts": "^2.1.0",
"rxjs": "^5.1.0",
"tslint": "^4.4.2",
"typescript": "^2.0.10",
"underscore": "^1.8.3",
"zone.js": "^0.7.6"
},
"devDependencies": {
"#angular/cli": "1.0.0-rc.0",
"#angular/compiler-cli": "^2.4.0",
"#types/jasmine": "2.5.38",
"#types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.4.2",
"typescript": "~2.0.0"
}
}
Why is Heroku not detecting Node?
According to the Heroku documentation
To determine how to start your app, Heroku first looks for a Procfile.
If no Procfile exists for a Node.js app, we will attempt to start a
default web process via the start script in your package.json.
So you shouldn't need to set the build pack.
I have two package.jsons, one for client and one for server. I needed to put my server dependencies into the root folder (they were each nested in client and server folders, respectively). Moving it into root made it detectable by heroku. Of course, now I have a new error. :)

VS2015: "Cannot find type definition" and "File not found" errors

I have an Angular2 app which worked perfectly fine until two days ago. When I tried to build the solution in Visual Studio 2015, I got 10 errors:
Build: Cannot find type definition file for 'hammerjs'.
Build: Cannot find type definition file for 'jasmine'.
Build: File (...)/wwwroot/lib/ng2-translate/index.ts' not found.
And 6 more about various files in ng2-translate not found.
Surprisingly, when I build my app by dotnet run command, it works well.
I updated everything by npm-check-updates -u, but it didn't change anything.
My package.json:
{
"version": "1.0.0",
"name": "CarMarket",
"private": true,
"dependencies": {
"#angular/common": "~4.0.3",
"#angular/compiler": "~4.0.3",
"#angular/core": "~4.0.3",
"#angular/forms": "~4.0.3",
"#angular/http": "~4.0.3",
"#angular/platform-browser": "~4.0.3",
"#angular/platform-browser-dynamic": "~4.0.3",
"#angular/router": "~4.0.3",
"#angular/upgrade": "~4.0.3",
"angular-in-memory-web-api": "~0.3.1",
"body-parser": "1.17.1",
"bootstrap": "3.3.7",
"chart.js": "^2.5.0",
"core-js": "^2.4.1",
"es6-shim": "^0.35.0",
"fancybox": "3.0.0",
"jquery": "3.2.1",
"ng2-charts": "^1.5.0",
"ng2-translate": "^5.0.0",
"reflect-metadata": "^0.1.8",
"rxjs": "5.3.0",
"systemjs": "0.20.12",
"zone.js": "^0.8.9"
},
"devDependencies": {
"#types/node": "^7.0.13",
"del": "2.2.2",
"gulp": "3.9.1",
"gulp-typescript": "3.1.6",
"gulp-watch": "4.3.11",
"merge": "1.2.0",
"typescript": "^2.0.10",
"typings": "^2.1.1"
},
"scripts": {
"postinstall": "typings install"
}
}
What might be the reason of those errors? H
As the error clearly states, you are missing type definitions for hammerjs and jasmine. You can either add them to your typings definition file, or you can install the types packages directly:
npm install --save #types/hammerjs
npm install --save #types/jasmine

Resources