I'm trying to import an image in NextJS:
import linkedin from "../public/images/linkedin.webp";
While referencing this variable dynamically during runtime:
const socialButtons = [];
for (let i = 0; i < Object.keys(data.socials).length; i++) {
socialButtons.push(
<Image
src={eval(Object.keys(data.socials)[i])} //this line gives error
width={48}
height={48}
alt="linkedin"
/>
);
}
I'm getting this error:
Unhandled Runtime Error
ReferenceError: linkedin is not defined
Related
I m am getting this error in console. For my JavaScript
var onepro = document.getElementsByClassName('pro')
var mainimg = document.getElementById('MainImg');
for (var i = 0; i < 17; i++) {
onepro[i].addEventListener('click', ()=>{
console.log('done')
window.location.href = 'sproduct.html';
mainimg.src = "img/products/f4.jpg";
})
}
here onepro and mainimg are from two different html files connected by this js file
Actually i am tying to replace image of one html file to other html file on click ``
please see these functions and the corresponding codepen:
https://codepen.io/ngodeinweb/pen/QWWevjR
function encrypt(){
var inputan = document.getElementById('inputan').value;
var encrypted = CryptoJS.AES.encrypt(inputan, "Ngodeinweb");
document.getElementById('app').innerHTML = encrypted;
}
function decrypte(){
var inputan2 = document.getElementById('inputan2').value;
var decrypted = CryptoJS.AES.decrypt(inputan2, "Ngodeinweb");
document.getElementById('app2').innerHTML = decrypted.toString(CryptoJS.enc.Utf8);
}
The code there works, but when seeing the browser developer console, this error have occured when the page was loaded:
How can this be solved?
Thanks
I need to use this JS file in my vue3 project.
https://gist.github.com/imolorhe/b31f95e1548ad7d1b233de26267fe21c#file-jungle-js
My JS library is
import { Jungle } from "./jungle.js";
async pitchTransform(
audioBuffer,
pitchMod
) {
let ctx = new OfflineAudioContext(
audioBuffer.numberOfChannels,
audioBuffer.length,
audioBuffer.sampleRate
);
let source = ctx.createBufferSource();
source.buffer = audioBuffer;
let pitchChangeEffect = new Jungle(ctx);
}
The application shows this error:
Uncaught SyntaxError: The requested module '/src/js/jungle.js?t=1659194585032' does not provide an export named 'Jungle' (at voiceTransform.js?t=1659199164108:1:10)
What's the recommend way to include and use jungle.js in this setup?
As the error is saying, that file has no export named "Jungle". In fact it has none.
You have to export that function manually, by editing that file and appending an export keyword:
// ...
export function Jungle(context) {
// ...
I'm trying to set up a Back4App backend in a react native expo 45 app. I keep getting a
[Unhandled promise rejection: ReferenceError: Can't find variable: indexedDB]
warning related to the async-storage and Parse import.
import AsyncStorage from "#react-native-async-storage/async-storage";
const Parse = require("parse/react-native.js");
Parse.setAsyncStorage(AsyncStorage);
The warning points to a function in
node_modules\parse\node_modules\idb-keyval\dist\compat.cjs
function createStore(dbName, storeName) {
var dbp = safariFix__default['default']().then(function () {
var request = indexedDB.open(dbName);
request.onupgradeneeded = function () {
return request.result.createObjectStore(storeName);
};
return promisifyRequest(request);
});
return function (txMode, callback) {
return dbp.then(function (db) {
return callback(db.transaction(storeName, txMode).objectStore(storeName));
});
};
}
I find almost no results with searches so I don't even know where to begin troubleshooting. Am I missing something or can this just be ignored?
The problem is in Parse#3.4.2
I reverted back to Parse#3.4.0 and all is working again for now.
I'm working on a game using spark ar, by following the tutorial from youtube (blinking game tutorial).
apparently when I was working there was an error in the script
const Scene = require('Scene');
export const Diagnostics = require('Diagnostics');
const Patches = require("Patches");
Promise.all([
Scene.root.findFirst('number'),]).then(onReady);
function onReady(assets) {
var counterNumber = assets[0];
var scoreNumber = p.outputs.getScalar("score");
scoreNumber.then(e => {
e.monitor().subscribe(value => {
counterNumber.text = value.newValue.toString();
});
});
}
Error : Possible Unhandled Promise Rejection: ReferenceError: Property 'p' doesn't exist
create a const P as below and check whether its working or not
const Scene = require('Scene');
const P = require('Patches');
reference taken from Score Didnt show up (Spark AR)
the problem is on this line :
var scoreNumber = p.outputs.getScalar("score");
"p" is not defined anywhere in your entire code that's why it is throwing error