Angular 4 - Unhandled Promise rejection: Object(...) is not a function ; Zone: - javascript

I don't know suddenly what happened but now I am facing some issue. Till the time app was working fine. But now whenever I am trying to run the app from android studio or xcode, I can see below error on chrome console. I did some research but not able to find anything. It would be great if someone could help me.
I am not using any kind of http service.
Current configuration of project-
1. ionic - v3
2. Angular - 4
3. Cordova
Unhandled Promise rejection: Object(...) is not a function ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Object(...) is not a function
at new ApplicationRef (vendor.js:5187)
at _createClass (vendor.js:8954)
at _createProviderInstance (vendor.js:8916)
at initNgModule (vendor.js:8849)
at new NgModuleRef_ (vendor.js:9575)
at createNgModuleRef (vendor.js:9564)
at Object.debugCreateNgModuleRef [as createNgModuleRef] (vendor.js:11389)
at NgModuleFactory_.create (vendor.js:12091)
at vendor.js:4987
at t.invoke (polyfills.js:3) TypeError: Object(...) is not a function
at new ApplicationRef (file:///android_asset/www/build/vendor.js:5187:64)
at _createClass (file:///android_asset/www/build/vendor.js:8954:20)
at _createProviderInstance (file:///android_asset/www/build/vendor.js:8916:26)
at initNgModule (file:///android_asset/www/build/vendor.js:8849:32)
at new NgModuleRef_ (file:///android_asset/www/build/vendor.js:9575:9)
at createNgModuleRef (file:///android_asset/www/build/vendor.js:9564:12)
at Object.debugCreateNgModuleRef [as createNgModuleRef] (file:///android_asset/www/build/vendor.js:11389:12)
at NgModuleFactory_.create (file:///android_asset/www/build/vendor.js:12091:25)
at file:///android_asset/www/build/vendor.js:4987:43
at t.invoke (file:///android_asset/www/build/polyfills.js:3:14976)

Related

Ionic ion-menu-button not working on first load

<ion-menu-button autoHide="false"></ion-menu-button>
At first load it give an error:
zone.js:1102 Unhandled Promise rejection: Cannot read properties of undefined (reading 'offsetWidth') ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Cannot read properties of undefined (reading 'offsetWidth')
If we reload then working fine please help me to fix it...

Why is the vanilla JS example for RxDB not working

I've followed the instructions at GitHub, but the example doesn't work.
The app shows "Starting database".
At the browser console there is this error:
Uncaught (in promise) TypeError: storage is undefined
_callee6$ http://127.0.0.1:20202/dist/rxdb.browserify.js:11032
tryCatch http://127.0.0.1:20202/dist/rxdb.browserify.js:70936
invoke http://127.0.0.1:20202/dist/rxdb.browserify.js:71167
defineIteratorMethods http://127.0.0.1:20202/dist/rxdb.browserify.js:70992
asyncGeneratorStep http://127.0.0.1:20202/dist/rxdb.browserify.js:14068
_next http://127.0.0.1:20202/dist/rxdb.browserify.js:14090
_asyncToGenerator http://127.0.0.1:20202/dist/rxdb.browserify.js:14097
_asyncToGenerator http://127.0.0.1:20202/dist/rxdb.browserify.js:14086
_createRxDatabaseStorageInstances http://127.0.0.1:20202/dist/rxdb.browserify.js:11060
createRxDatabaseStorageInstances http://127.0.0.1:20202/dist/rxdb.browserify.js:11017
_callee7$ http://127.0.0.1:20202/dist/rxdb.browserify.js:11075
tryCatch http://127.0.0.1:20202/dist/rxdb.browserify.js:70936
invoke http://127.0.0.1:20202/dist/rxdb.browserify.js:71167
defineIteratorMethods http://127.0.0.1:20202/dist/rxdb.browserify.js:70992
asyncGeneratorStep http://127.0.0.1:20202/dist/rxdb.browserify.js:14068
_next http://127.0.0.1:20202/dist/rxdb.browserify.js:14090
_asyncToGenerator http://127.0.0.1:20202/dist/rxdb.browserify.js:14097
_asyncToGenerator http://127.0.0.1:20202/dist/rxdb.browserify.js:14086
_prepare http://127.0.0.1:20202/dist/rxdb.browserify.js:11104
prepare http://127.0.0.1:20202/dist/rxdb.browserify.js:11064
createRxDatabase http://127.0.0.1:20202/dist/rxdb.browserify.js:11142
<anonymous> http://127.0.0.1:20202/main.js:33
When I try to add a hero and click the "Insert" button this error appears at the console:
Uncaught ReferenceError: col is not defined
addHero http://127.0.0.1:20202/main.js:97
onclick http://127.0.0.1:20202/:1
Ist this a bug or am I missing something?
According to the rxdb v10 release notes:
"...many (example projects) are outdated and need updates."
I was as well not able to get it working.

Tests not running in Testcafe getting error 'TypeError: Cannot read property 'split' of undefined'

New to TestCafe .. just copied the code from their site and executed it.
import { Selector } from 'testcafe';
fixture `Getting Started`
.page `http://devexpress.github.io/testcafe/example`;
test('My first test', async t => {
await t
.typeText('#developer-name', 'John Smith')
.click('#submit-button');
});
The browsers are connected successfully but script is not executed and got error after some time
Nimits-MacBook-Pro:TestCafe nimit$ testcafe chrome demo.js
ERROR Was unable to open the browser "chrome:" due to error.
TypeError: Cannot read property 'split' of undefined
at Object.callee$0$0$ (/usr/local/lib/node_modules/testcafe/node_modules/testcafe-browser-tools/lib/api/find-window.js:111:36)
at tryCatch (/usr/local/lib/node_modules/testcafe/node_modules/testcafe-browser-tools/node_modules/babel-runtime/regenerator/runtime.js:72:40)
at Generator.invoke [as _invoke] (/usr/local/lib/node_modules/testcafe/node_modules/testcafe-browser-tools/node_modules/babel-runtime/regenerator/runtime.js:334:22)
at Generator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/testcafe/node_modules/testcafe-browser-tools/node_modules/babel-runtime/regenerator/runtime.js:105:21)
at tryCatch (/usr/local/lib/node_modules/testcafe/node_modules/testcafe-browser-tools/node_modules/babel-runtime/regenerator/runtime.js:72:40)
at invoke (/usr/local/lib/node_modules/testcafe/node_modules/testcafe-browser-tools/node_modules/babel-runtime/regenerator/runtime.js:146:20)
at /usr/local/lib/node_modules/testcafe/node_modules/testcafe-browser-tools/node_modules/babel-runtime/regenerator/runtime.js:154:13
Environment
nodejs version - 10.16.0
npm - 6.9.0
OS - MACOS catalina
TestCafe - 1.6.0

uncaught TypeError: Cannot read property 'substr' of undefined ionic

Suddenly im getting error when i start ionic project
TypeError: Cannot read property 'substr' of undefined
at Function.<anonymous> (D:\Work\Prince\TakeToTake\node_modules\source-map\lib\source-node.js:115:26)
at Array.forEach (native)
at BasicSourceMapConsumer.SourceMapConsumer_eachMapping [as eachMapping] (D:\Work\Prince\TakeToTake\node_modules\source-map\lib\sour
at Function.SourceNode_fromStringWithSourceMap [as fromStringWithSourceMap] (D:\Work\Prince\TakeToTake\node_modules\source-map\lib
at SourceMapSource.node (D:\Work\Prince\TakeToTake\node_modules\webpack-sources\lib\SourceMapSource.js:39:21)
at ReplaceSource.node (D:\Work\Prince\TakeToTake\node_modules\webpack-sources\lib\ReplaceSource.js:70:30)
at CachedSource.node (D:\Work\Prince\TakeToTake\node_modules\webpack-sources\lib\CachedSource.js:18:24)
at D:\Work\Prince\TakeToTake\node_modules\webpack-sources\lib\ConcatSource.js:37:50
at Array.map (native)
at ConcatSource.node (D:\Work\Prince\TakeToTake\node_modules\webpack-sources\lib\ConcatSource.js:36:63)
Please Help
Found the error
i was implement two Component inside one TS file that's why the nodeJS confuse to run which component
now i created another ts file to implement the component
thanks for the comments

Angular JS Karma module not found

I get an error message -"ReferenceError: module is not defined" when trying to test angular js code.
test script [testSpec.js]
describe('Project controllers', function() {
beforeEach(module('project'));
describe('ListCtrl', function() {
expect(1).toBe(1);
});
});
I have the following entries in my html file
<script src="angular.min.js"></script>
<script src="angular-resource.min.js"></script>
<script src="angular-mocks.js"></script>
followed by my test script - testSpec.js
I specifically included angular.js and angular-mocks.js again. I get to see the following error message
Chrome 31.0.1650 (Windows 7) Project controllers ListCtrl should create 11 records FAILED
TypeError: Object #<Object> has no method 'apply'
Error: Unknown provider: ProjectsProvider <- Projects
at Error (<anonymous>)
at c:/Angular/angular-phonecat/app/angular.min.js:30:24
at Object.c [as get] (c:/Angular/angular-phonecat/app/angular.min.js:27:310)
at c:/Angular/angular-phonecat/app/angular.min.js:30:109
at c (c:/Angular/angular-phonecat/app/angular.min.js:27:310)
at d (c:/Angular/angular-phonecat/app/angular.min.js:27:444)
at Object.instantiate (c:/Angular/angular-phonecat/app/angular.min.js:29:80)
at c:/Angular/angular-phonecat/app/angular.min.js:53:80
at null.<anonymous> (c:/Angular/angular-phonecat/app/testSpec.js:10:12)
at Object.d [as invoke] (c:/Angular/angular-phonecat/app/angular.min.js:28:464)
Error: Declaration Location
at window.jasmine.window.inject.angular.mock.inject (c:/Angular/angular-phonecat/app/angular-mocks.js:1781:2
Here is the complete error
5) at null.<anonymous> (c:/Angular/angular-phonecat/app/testSpec.js:8:34)\n
at null.<anonymous> (c:/Angular/angular-phonecat/app/testSpec.js:6:2)\n
at c:/Angular/angular-phonecat/app/testSpec.js:2:1
Chrome 31.0.1650 (Windows 7) Project controllers ListCtrl should contain new fields FAILED
TypeError: Object #<Object> has no method 'apply'
Error: Unknown provider: ProjectsProvider <- Projects
I'm suspecting that you're missing some include files in you karma config file. Specifically, make sure you load angular.js.
Did you include angular-mocks.js ?
That should solve your problem.
You need that for it to work.

Categories

Resources