Failed to execute 'define' on 'CustomElementRegistry': - javascript

I'm facing the following issue. I've started migrating my app to react and i've created my first module. So I have my legacy code which is loading my react app bundle.js so I can use the new react module.
When I use my navigation to go to the new react module everything works fine. When I use the same link again I get the following error and the page is blank:
Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "input-mask" has already been used with this registry
Any suggestions to fix this problem?

I had the same error. These two references coexisted in the same javascript file.
require("inputmask");
require("inputmask/dist/jquery.inputmask.js");
Removing the first one solved the issue for me.

Related

firebase.initializeApp() vs FirebaseApp.initializeApp()

I currently trying to set up push notifications using the Notifications package from 'expo-notifications', Im just getting the following error and I cant work around it:
[Error: Encountered an exception while calling native method: Exception occurred while executing exported method getDevicePushTokenAsync on module ExpoPushTokenManager: Default FirebaseApp is not initialized in this process com.-----.-----. Make sure to call FirebaseApp.initializeApp(Context) first.]
The thing is, this message is completely enraging me because I do call:
import * as firebase from "firebase";
and after that:
firebase.initializeApp(ApiKeys);
at the start of my app.
Do I now need to install the Firebase/App package so I can do FirebaseApp.initializeApp()? Do I need to initialize my app 2 times then?
Neither the docs from expo are mentioning such an error, nor I found anything related to this error in the firebase docs and Im really struggling with this one.
Aperently there is an import into the app/build.gradle file which is not mentioned inside the expo docs at all. Its the following line which is missing:
implementation("com.google.firebase:firebase-iid")
you need to put it inside your app/build.gradle file to make it work.
I found it in the following forum, the posts are just one month old so its a quite new bug.

typescript error on importing fuse.js library

I am getting the typescript error every-time time to compile the code. the issues in fuse.js library and it throws an error Module '"../../../../Users/moinahmed/react-icon-emoji-picker/node_modules/fuse.js/dist/fuse"' has no exported member 'FuseResult'.
I have tried everything but could not solve this issue, the localhost starts running for a few seconds and then the app crashes and throws this error
FuseResult isn't directly exported from fuse.js,
The remedy is to use type FuseResult<T> = Fuse.FuseResult<T>; to alias FuseResult to Fuse.FuseResult. Playground
You can also use Fuse.FuseResult everywhere, but since you wanted to directly import I am assuming you don't want to rewrite this every time.

Array.prototype.flat() creates an error when building Gatsby site

When building, I get the following error:
WebpackError: TypeError: Object.entries(...).map(...).flat is not a function
I can gatsby deveop the app just fine, and all works as expected in the browser.
Any ideas on how to remedy this?
I'm not sure if this is ideal, but the only way I was able to fix this was by adding a polyfill and including it at the top of the offending file.
> yarn add array-flat-polyfill
// src/pages/page-with-error.js
import 'array-flat-polyfill';

require() finding process.version to be undefined

I am trying to create a dashboard based off an existing dashboard template located below:
https://github.com/creativetimofficial/vuetify-material-dashboard
I am trying to integrate azure-storage into my solution in order to upload files directly to Azure.
https://github.com/Azure/azure-storage-node
The following require statement is used to import azure-storage
var azure = require('azure-storage');
However I am getting the following error:
TypeError: process.version is undefined
I have tried reinstalling all modules as well as process. I thought that process was a globally defined variable, and I can't understand why version is returning undefined. What could be causing this issue?
Tried to debug by printing all properties of process and this is what I have:
Thanks.

Error while loading zone.js and main.js file

I have a django(1.6.11) project running perfectly fine. I want to use it with Angular2. So, I have been following this example. I am getting the following error on localhost:8000 page. By the way it shows Cannot GET / in localhost:3000.
Error: Zone$1http://localhost:8000/ng/node_modules/zone.js/dist/zone.js:232:1
Zone$1http://localhost:8000/ng/node_modules/zone.js/dist/zone.js:114:17
scheduleResolveOrReject/<#http://localhost:8000/ng/node_modules/zone.js/dist/zone.js:502:78
Zone$1http://localhost:8000/ng/node_modules/zone.js/dist/zone.js:265:1
Zone$1http://localhost:8000/ng/node_modules/zone.js/dist/zone.js:154:21
drainMicroTaskQueue#http://localhost:8000/ng/node_modules/zone.js/dist/zone.js:401:25
ZoneTask/this.invoke#http://localhost:8000/ng/node_modules/zone.js/dist/zone.js:339:25
Evaluating http://localhost:8000/ng/src/main.js Error loading
http://localhost:8000/ng/src/main.js localhost:8000:25
Following a suggestion for a question on stackoverflow, I changed loading long-stack-trace-zone.js instead of zone.js in my index.html code. But this says, Zone is not defined. Is this some version compatibility issue? I am using npm 4.1.1 and node v4.8.3. Please do comment if I need to show any of my files.

Categories