Errors on my code are alerts, instead of console.errors - javascript

I'm working on Vue.js project, and suddely errors than where errors on console, (console.error) are alerts, (normal browser alerts).
Example. I force this error writing (undefined).anyProperty
console looks:
My package.json modules:
"dependencies": {
"axios": "^0.18.0",
"bootstrap-vue": "^2.0.0-rc.11",
"naranja": "^1.0.2",
"vue": "^2.5.2",
"vue-router": "^3.0.1",
"vuex": "^3.0.1"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"chalk": "^2.0.1",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.0",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"node-notifier": "^5.1.2",
"node-sass": "^4.11.0",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"rimraf": "^2.6.0",
"sass-loader": "^7.1.0",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^0.5.8",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.2",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
I cand debug in alerts, because objects are [Object object], thanks for helps.

I don't know anything about Vue, but my recommendation for debugging this would be to replace the window.alert function with you own function containing a debugger
let oldWindowAlert = window.alert;
window.alert = function(){
debugger;
oldWindowAlert.apply(window, arguments);
}
Then, once you catch the debugger, you can investigate the call stack (in Chrome this is very easy) to trace down what function is emitting this alert.

So I did a bit of research for you, but haven't actually tested my hypothesis so take this with a grain of salt...
My gut tells me that somewhere in the code there is an event handler attached to the window error event which alerts the error message and swallows the error. Search the codebase for addEventHandler('error', addEventHandler("error", and onerror, and get rid of it :-)

The docs lead me to believe that Node_Notifier is the culprit. Hard to tell without seeing your code but maybe see what happens if you remove it?

Related

Tried to register two views with the same name RCTScrollView

i try to run my react native app to ios but i got this error, while in android the app work just fine, do someone know about this ?
xcode 11.5,
rn 0.61.5,
using react native cli
i already search on several site but dont seem find any solution, here the screen shoot :
"dependencies": {
"#microsoft/signalr": "^3.1.3",
"#react-native-community/async-storage": "^1.7.1",
"#react-native-community/datetimepicker": "^2.2.1",
"#react-native-community/masked-view": "0.1.5",
"#react-native-community/picker": "^1.6.1",
"#react-native-community/viewpager": "3.3.0",
"#sentry/react-native": "^1.4.1",
"axios": "^0.19.1",
"color": "^3.1.2",
"ellipsize": "^0.1.0",
"form-data": "^3.0.0",
"google-translate": "^3.0.0",
"i18n-js": "^3.5.1",
"intl": "^1.2.5",
"moment": "^2.24.0",
"moment-range": "^4.0.2",
"numeral": "^2.0.6",
"opentok-react-native": "^0.12.2",
"react": "16.9.0",
"react-cookies": "^0.1.1",
"react-native": "0.61.5",
"react-native-amazing-cropper": "^0.1.1",
"react-native-biometrics": "^2.1.4",
"react-native-camera": "^3.17.0",
"react-native-collapsible": "^1.5.1",
"react-native-daterange-picker": "^1.1.3",
"react-native-device-info": "^5.5.3",
"react-native-file-picker": "0.0.19",
"react-native-geocoder": "^0.5.0",
"react-native-gesture-handler": "^1.5.3",
"react-native-image-crop-tools": "^1.3.4",
"react-native-image-picker": "^2.3.0",
"react-native-localize": "^1.4.0",
"react-native-location": "^2.5.0",
"react-native-masked-text": "^1.13.0",
"react-native-onesignal": "^3.6.3",
"react-native-overlay-section": "0.1.13",
"react-native-paper": "3.4.0",
"react-native-reanimated": "^1.4.0",
"react-native-responsive-screen": "1.4.0",
"react-native-safe-area-context": "0.6.2",
"react-native-screens": "2.0.0-alpha.22",
"react-native-vector-icons": "^6.6.0",
"react-native-webview": "8.1.1",
"react-navigation": "^4.0.10",
"react-navigation-stack": "^2.0.4",
"react-navigation-tabs": "^2.7.0",
"react-redux": "^7.1.3",
"reanimated-bottom-sheet": "1.0.0-alpha.18",
"redux": "^4.0.5",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"sendbird": "3.0.117",
"styled-components": "^4.4.1",
"throttle-debounce": "^2.1.0",
"validator": "^12.1.0"
},
The error is coming from the react-native-gesture-handler package.
Did you import it in your code ? If yes, try to remove the import and do a rm -rf node_modules && npm install.
If this doesn't work, try to update it (Latest version at the moment is ^1.6.1) in your package.json.
sorry just found the problem, in my app there are custom native library that use scroll view in folder src, that causing register view two times.

Babel-Loader Error Plugin/Preset files are not allowed to export objects, only functions

After updating all my outdated npm packages to #latest, my electron app fails to start, giving the error
ERROR in ./src/index.js
[0] Module build failed (from ./node_modules/babel-loader/lib/index.js):
[0] Error: Plugin/Preset files are not allowed to export objects, only functions. In /Users/nyxynyx/foobar/node_modules/babel-preset-stage-0/lib/index.js
Any idea what went wrong? Thank you everyone!
.babelrc
{
"presets": ["env", "stage-0", "react"],
"plugins": [
"babel-plugin-styled-components",
"react-hot-loader/babel",
["transform-class-properties", { "loose": true }]
]
}
package.json (dependencies & devDependencies)
"dependencies": {
"#fortawesome/fontawesome-svg-core": "^1.2.21",
"#fortawesome/free-solid-svg-icons": "^5.10.1",
"#fortawesome/react-fontawesome": "^0.1.4",
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.2",
"babel-loader": "^8.0.6",
"babel-plugin-styled-components": "^1.10.6",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"babel-register": "^6.26.0",
"bootstrap": "^4.3.1",
"css-loader": "^3.2.0",
"electron-log": "^3.0.7",
"electron-updater": "^4.1.2",
"file-loader": "^4.2.0",
"firebase": "^6.3.4",
"fix-path": "^2.1.0",
"json-loader": "^0.5.7",
"lodash": "^4.17.15",
"menubar": "^6.0.7",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-redux": "^7.1.0",
"react-redux-firebase": "^2.3.0",
"reactstrap": "^8.0.1",
"redux": "^4.0.4",
"redux-thunk": "^2.3.0",
"style-loader": "^1.0.0",
"styled-components": "^4.3.2",
"typeface-open-sans": "0.0.75",
"url-loader": "^2.1.0"
},
"devDependencies": {
"concurrently": "^4.1.1",
"devtron": "^1.4.0",
"electron": "^6.0.1",
"electron-builder": "^21.2.0",
"electron-debug": "^3.0.1",
"electron-devtools-installer": "^2.2.4",
"eslint": "^6.1.0",
"eslint-config-airbnb": "^17.1.1",
"eslint-import-resolver-webpack": "^0.11.1",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.14.3",
"express": "^4.17.1",
"react-dom": "^16.8.6",
"react-hot-loader": "^4.12.10",
"react-router": "^5.0.1",
"react-router-dom": "^5.0.1",
"stylelint": "^10.1.0",
"stylelint-config-standard": "^18.3.0",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^4.39.1",
"webpack-dev-middleware": "^3.7.0",
"webpack-hot-middleware": "^2.25.0",
"webpack-merge": "^4.2.1"
},
Using node v12.6.0 on Mac OS X Mojave 10.14.5
I am moving my answer from comment due to lack of space there :)
Try using new packages for babel-core, babel-register and presets, replacing the old ones since they are depricated (babel-core, babel-presets-env, etc):
#babel/core - https://www.npmjs.com/package/#babel/core,
#babel/presets-env - https://babeljs.io/docs/en/babel-preset-env,
#babel/presets-react - https://babeljs.io/docs/en/babel-preset-react,
#babel/presets-stage-0 https://babeljs.io/docs/en/babel-preset-stage-0,
#babel/polyfill - https://babeljs.io/docs/en/babel-polyfill and
#babel/register - https://babeljs.io/docs/en/babel-register.
Then try deleting package.lock, and running again npm i . If that is not helping you can also try deleting node_modules folder, and running npm i again
babel-preset-env / babel-preset-react packages are deprecated.
use #babel/preset-env and #babel/preset-react packages.
And do the following change in .babelrc :
"presets": ["#babel/env", "#babel/react"]
That is due to outdated babel packages being used. The babel project, just like most other active Javascript projects, have moved on to using scope packages. Hence, the package names starts with #babel
Check this to fix issue

BackAndroid is deprecated and has been removed from this package. Use BackHandler instead

I updated the version of React, Expo and React-Native
Now I have a red screen on my device saying that BackAndroid is deprecated and has been removed from this package. Use BackHandler instead But I don't where is BackAndroid, I can't know it is used in which package.
That's my package.json
"#expo/vector-icons": "^9.0.0",
"babel-plugin-module-resolver": "^3.1.3",
"babel-plugin-transform-react-jsx-source": "^6.22.0",
"babel-preset-expo": "^5.0.0",
"expo": "^33.0.0",
"lato-font": "^3.0.0",
"lodash": "^4.17.14",
"react": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
"react-native-app-intro-slider": "0.2.4",
"react-native-bottomsheet": "^1.9.3",
"react-native-customisable-switch": "^0.1.0",
"react-native-dialog-input": "^1.0.7",
"react-native-gesture-handler": "^1.0.0-alpha.43",
"react-native-image-base64": "^0.1.3",
"react-native-js-bottom-sheet": "^1.1.0",
"react-native-keyboard-aware-scroll-view": "^0.8.0",
"react-native-loading-spinner-overlay": "^1.0.1",
"react-native-modal": "5.4.0",
"react-native-modalbox": "^1.7.1",
"react-native-prompt": "^1.0.0",
"react-native-prompt-android": "^0.3.5",
"react-native-swipeable": "^0.6.0",
"react-native-tab-view": "^0.0.77",
"react-native-vector-icons": "^6.2.0",
"react-navigation": "^2.18.0",
"react-waterfall": "3.0.7",
"sentry-expo": "^1.7.0",
"tcomb-form-native": "0.6.11",
"timeago.js": "^3.0.2"
the error

Random script error. in Angular Unit/Integration Tests

I have the following problem:
When I run unit/integration tests for my Angular project with Karma, there is like a 50:50 chance that my tests will succeed/fail. Mostly it works on my maschine (:D), but not on our build server and that makes it really unreliable at all.
When it fails, it is always a cryptic error message, which says
script error.
...nothing more. Now the strange thing about it is, that it is always another test which fails.
Here is what I already did or had a look at:
https://github.com/karma-runner/karma/issues/1268
https://github.com/karma-runner/karma/issues/543
I do not have circular dependencies (at least ng build/serve doesn't complain about it)
I figured out, that It could be linked to a cross-origin-policy violation, but I actually don't trigger XHR's or lazy load other stuff (at least I think so)
These are my dependencies:
"dependencies": {
"#angular/animations": "^6.0.9",
"#angular/cdk": "^6.4.0",
"#angular/common": "^6.0.9",
"#angular/compiler": "^6.0.9",
"#angular/core": "^6.0.9",
"#angular/flex-layout": "^6.0.0-beta.16",
"#angular/forms": "^6.0.9",
"#angular/http": "^6.0.9",
"#angular/material": "^6.4.0",
"#angular/platform-browser": "^6.0.9",
"#angular/platform-browser-dynamic": "^6.0.9",
"#angular/platform-server": "^6.0.9",
"#angular/router": "^6.0.9",
"#ngrx/effects": "^6.0.1",
"#ngrx/router-store": "^6.0.1",
"#ngrx/store": "^6.0.1",
"#ngrx/store-devtools": "^6.0.1",
"core-js": "^2.5.7",
"devextreme": "^18.1.4",
"devextreme-angular": "^18.1.4",
"i": "^0.3.6",
"jquery": "^3.3.1",
"ngx-scrollbar": "^2.1.0",
"node-sass": "^4.9.0",
"npm": "^6.2.0",
"rxjs": "^6.2.2",
"stream": "0.0.2",
"web-animations-js": "^2.3.1",
"zone.js": "^0.8.26"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.6.3",
"#angular/cli": "^6.0.8",
"#angular/compiler-cli": "^6.0.9",
"#angular/language-service": "^6.0.9",
"#types/jasmine": "^2.8.8",
"#types/jasminewd2": "^2.0.3",
"#types/node": "^10.5.2",
"codelyzer": "^4.4.2",
"fs-extra": "^6.0.1",
"git-describe": "^4.0.3",
"gulp": "^4.0.0",
"gulp-param": "^1.0.3",
"gulp-run": "^1.7.1",
"hogan.js": "^3.0.2",
"husky": "^0.14.3",
"jasmine-core": "^3.1.0",
"jasmine-spec-reporter": "^4.2.1",
"jszip": "^3.1.5",
"karma": "^2.0.4",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^2.0.1",
"karma-jasmine": "^1.1.2",
"karma-jasmine-html-reporter": "^1.2.0",
"license-checker": "^20.1.0",
"lint-staged": "^7.2.0",
"markdown-include": "^0.4.3",
"prettier": "^1.13.7",
"protractor": "^5.3.2",
"readline-sync": "^1.4.9",
"run-sequence": "^2.2.1",
"stylelint": "^9.3.0",
"stylelint-config-recommended-scss": "^3.2.0",
"stylelint-config-standard": "^18.2.0",
"stylelint-scss": "^3.1.3",
"ts-node": "^6.2.0",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.13.0",
"typescript": "2.7.2",
"yargs": "^11.1.0"
}
What should I do next ??
I appreciate every hint...thanks
From my experience, many times such random errors are due to a dirty state one of the test left behind which in turn fails some other test.
AFAIK the default order for Karma is not expected or defined.
I would try to comment out (binary search style) the first half of the tests and see if it passes consistently.
I finally fixed the issue.
I somehow came on the right track and figured out, which test fails or rather is causing other tests to fail.
// causing part in the tests
beforeEach(() => {
fixture = TestBed.createComponent(FilterSidebarComponent);
component = fixture.componentInstance;
component.data = {} as DataClass;
fixture.detectChanges();
});
The problem was now, that inside a subscription in the component, I call a specific method of the class DataClass:
this.attributeXY.subscribe(event => {
this.data.reset(); <-- reset() was undefined
if (event) {
// do something
...
}
})
The remaining question now is, why the cast of the empty object didn't work in this case?
My expectation was, that the method reset()would be inferred as well

Webpack Error: please install sqlite3 package manually

I'm building an application with Electron and Sequelize. I started to configure my database, then, I've received this error:
Uncaught Error: Please install sqlite3 package manually
at new ConnectionManager (/home/matheusdrdj/Documentos/Git/personal-
management/node_modules/sequelize/lib/dialects/sqlite/con…:31)
at new SqliteDialect (/home/matheusdrdj/Documentos/Git/personal-
management/node_modules/sequelize/lib/dialects/sqlite/ind…:14)
at new Sequelize (/home/matheusdrdj/Documentos/Git/personal-
management/node_modules/sequelize/lib/sequelize.js:239)
at eval (index.js?17a5:3)
at Object. (renderer.js:1084)
at webpack_require (renderer.js:680)
at fn (renderer.js:90)
at eval (index.js?21f1:1)
at Object. (renderer.js:1077)
at webpack_require (renderer.js:680)
at fn (renderer.js:90)
at eval (main.js?3b76:1)
at Object. (renderer.js:918)
at webpack_require (renderer.js:680)
at fn (renderer.js:90)
at Object. (renderer.js:835)
at webpack_require (renderer.js:680)
at renderer.js:726
at renderer.js:729
I have installed sqlite3 globally and localy, tested it on the console and it's working fine. But, my application doesn't even load the screen.
My dependencies:
"dependencies": {
"axios": "^0.16.1",
"sequelize": "^4.37.7",
"sqlite3": "^4.0.0",
"vue": "^2.4.2",
"vue-electron": "^1.0.6",
"vue-router": "^2.5.3",
"vuetify": "1.0.0",
"vuex": "^2.3.1"
},
"devDependencies": {
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-0": "^6.24.1",
"babel-register": "^6.24.1",
"babili-webpack-plugin": "0.1.2",
"cfonts": "^1.1.3",
"chalk": "^2.1.0",
"copy-webpack-plugin": "^4.0.1",
"cross-env": "^5.0.5",
"css-loader": "^0.28.4",
"del": "^3.0.0",
"devtron": "^1.4.0",
"electron": "^1.7.5",
"electron-builder": "^19.19.1",
"electron-debug": "^1.4.0",
"electron-devtools-installer": "^2.2.0",
"electron-rebuild": "^1.7.3",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"html-webpack-plugin": "^2.30.1",
"js-sha256": "^0.9.0",
"multispinner": "^0.2.1",
"node-loader": "^0.6.0",
"style-loader": "^0.18.2",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"url-loader": "^0.5.9",
"vue-html-loader": "^1.2.4",
"vue-loader": "^13.0.5",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.4.2",
"webpack": "^3.5.2",
"webpack-dev-server": "^2.7.1",
"webpack-hot-middleware": "^2.18.2"
}
I cannot figure out what is happening.
With Electron sqlite3 has to be built with electron-builder.
How to use sqlite3 module with electron?
and https://github.com/electron-userland/electron-builder
both recommend adding this to your package.json
"postinstall": "electron-builder install-app-deps"
This will rebuild all native binaries everytime you install a new package.

Categories