uncaught DOMException after installing and using polymer element - javascript

I am following this tutorial which teaches the installation of polymer elements:
https://www.polymer-project.org/3.0/start/toolbox/add-elements
After running the npm install command and importing it using:
import '#polymer/paper-checkbox/paper-checkbox.js';
I am starting to get this error when the page loads:
Uncaught (in promise) DOMException: Failed to execute 'define' on 'CustomElementRegistry': this name has already been used with this registry
I had a look around and some say delete node models folder and others say to reinstall web components because there are conflicts between versions but none go into great detail on how this is done.

For me, deleting node_modules and package-lock.json, then running npm install fixed this. It appears to be due to duplicate dependencies within paper elements.

Related

Facing an error when deploying React app to github pages

I'm trying to deploy my react app to github pages but facing some errors.
At first, when I tried to run npm run deploy in the terminal, it showed me this error:
new MiniCssExtractPlugin({
^
And MiniCssExtractPlugin is not a constructor
After that, I tried: npm i -D --save-exact mini-css-extract-plugin#2.4.5
This solved the problem but when I ran it again (npm run deploy), I get this error:
Creating an optimized production build...
Failed to compile.
The target environment doesn't support dynamic import() syntax so it's not possible to use
external type 'module' within a script
I don't know why it doesn't work, and also didn't find anything on the internet.
Thanks!

This dependency was not found

When i try to npm run serve it stops at 98% and :
ERROR
Failed to compile with 1 error
This dependency was not found:
* #/components/HelloWorld.vue in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader-v16/dist??ref--0-1!./src/views/Home.vue?vue&type=script&lang=js
To install it, you can run: npm install --save #/components/HelloWorld.vue
I looked up for some sources but never helped. Even installing HelloWorld.vue turns an error.
It looks like one of your files is trying to load a local component called HelloWorld.vue and it may not exist in your project structure. You shouldn't try to "install" it, but rather head to the Home.vue file where this error is being triggered from (see Home.vue at th end of the error message?). Then ask yourself, do you actually want to load HelloWorld.vue?
I imagine you're following some sort of "getting started with Vue" guide and you've been instructed to include that file. You'll have to either create that file in the {YOUR_PROJECT}/src/components/ folder, or remove the code that's trying to load it.
Alternatively, this could be a configuration error in which you're trying to use the # alias but it hasn't been setup in webpack properly. Please include more info if this doesn't solve your problem.
Maybe Vue Js cli is not installed on server
// to install vue on ubuntu
npm install -g #vue/cli
// check if it was installed successfully
vue --version
#vue/cli 4.1.2

Application.js can't find #rails

I'm updating a fairly old project to rails 6, and adapt to current "rails ways". And I've just installed webpacker, but I've run into problem I can't seem to find a way to solve.
When running the project, I get this error: Uncaught Error: Cannot find module '#rails/ujs'
I've tried to reinstall rails-ujs through yarn, but to no effect.
Also I've tried to comment the line require("#rails/ujs").start() from my app/javascript/packs/application.js, and yet I got another error: Uncaught Error: Cannot find module '#rails/activestorage'.
Which leads me to believe that its the global #rails that is not being recognized, however I have no idea where is it set or how to do so.
My questions are:
Can I set #rails myself?
Is there a way to re-generate it?
or
Is there another configuration I should fix?
It’s not #rails which is missing, it’s the ujs (and active storage) JavaScript packages which are missing.
Run yarn install To install them.

How to use npm country codes

Hin I am new in node.js. I already created my project in cordova cross platform Mobile Application. Now I want to install npm country-codes package "https://www.npmjs.com/package/country-codes". I already install this from command line But I can't get country codes. It's display error
"Uncaught Error: Module name "countryCodes" has not been loaded yet for context: _. Use require([])
I don't konw how to solve it please help me.
I simple use this from npm doc. In my Project I used backbone.js and require.js
var countryCodes = require('countryCodes')
console.log(countryCodes)
Pay notice that this page module in NPM says the following:
This module is deprecated.
Please use the country-data package instead of this country-codes module. It is more well-maintained and the original author of this repository/package has decided to focus on that module instead. Here is a link to it: https://github.com/OpenBookPrices/country-data/. If you need help with a migration, please file an issue on that repository and tag #niftylettuce.
The second thing you need to do is to install it with npm command and it should appear under your node_modules folder
npm install country-codes
The error that you are experiencing is created by the common.js library which is the Node.js loader library.
This occurs when there is a require('name') call, but the 'name' module has not been loaded yet.

react-native-db-models Uncaught error

I am wanting to use the react-native-db-models for local-db on my React Native iOS app.
I've npm installed react-native-db-models from here and have followed the instructions on the page of creating a db.js file that contains the example given on both Github page and NPM page. Then in the file that needs access to the DB, I've created vars for both DB and DBEvents, following the docs accordingly.
When running the project in Xcode it results in a Build Fail.
uncaught error Error: UnableToResolveError: Unable to resolve module
util from /Users/tmhn/Project/DoppioHealth/node_modules/react-native-db-models/node_modules/promise-es6/lib/utils.js:
Invalid directory /Users/node_modules/util
I have also npm installed the two dependencies listed on the npm page: es6-promises and eventemitter3, to no avail.
Note: DoppioHealth is the project name
Investigated the Github Issues and found this solved the issue

Categories