JOY
JOY
KPCKevin Powell - Community
Created by JOY on 4/7/2024 in #front-end
ReferenceError: Request is not defined -while setting up sveltekit project
ReferenceError: Request is not defined
at getRequest (file:///C:/Users/welcome/Desktop/Ed/sveltkit-test/node_modules/@sveltejs/kit/src/exports/node/index.js:107:2)
at file:///C:/Users/welcome/Desktop/Ed/sveltkit-test/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:497:27
at processTicksAndRejections (node:internal/process/task_queues:96:5)
ReferenceError: Request is not defined
at getRequest (file:///C:/Users/welcome/Desktop/Ed/sveltkit-test/node_modules/@sveltejs/kit/src/exports/node/index.js:107:2)
at file:///C:/Users/welcome/Desktop/Ed/sveltkit-test/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:497:27
at processTicksAndRejections (node:internal/process/task_queues:96:5)
I just setup a fresh sveltekit project, when I opened the localhost it shows me the error above in the browser. No error in terminal console. node version using - v20.12.1 And also while creating a Vue project I get this error. command: npm create vue@latest ouptut:
TypeError: (0 , import_node_util.parseArgs) is not a function
at init (C:\Users\welcome\AppData\Local\npm-cache\_npx\2f7e7bff16d1c534\node_modules\create-vue\outfile.cjs:4481:72)
at Object.<anonymous> (C:\Users\welcome\AppData\Local\npm-cache\_npx\2f7e7bff16d1c534\node_modules\create-vue\outfile.cjs:4862:1)
at Module._compile (node:internal/modules/cjs/loader:1099:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
TypeError: (0 , import_node_util.parseArgs) is not a function
at init (C:\Users\welcome\AppData\Local\npm-cache\_npx\2f7e7bff16d1c534\node_modules\create-vue\outfile.cjs:4481:72)
at Object.<anonymous> (C:\Users\welcome\AppData\Local\npm-cache\_npx\2f7e7bff16d1c534\node_modules\create-vue\outfile.cjs:4862:1)
at Module._compile (node:internal/modules/cjs/loader:1099:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
Are these errors interlinked somehow? How to solve it?
72 replies
KPCKevin Powell - Community
Created by JOY on 11/1/2023 in #front-end
Javascript hashmap
function zappa(nums) {
const mapObj = new Map();
for (let i = 0; i < nums.length; i++) {
mapObj.set(nums[i], i);
}
return mapObj;
}
console.log(zappa([2, 7, 11, 15]));
function zappa(nums) {
const mapObj = new Map();
for (let i = 0; i < nums.length; i++) {
mapObj.set(nums[i], i);
}
return mapObj;
}
console.log(zappa([2, 7, 11, 15]));
its showing empty Object in console. But when i do
return mapObj.size
//console logs 4
return mapObj.size
//console logs 4
5 replies
KPCKevin Powell - Community
Created by JOY on 10/16/2023 in #front-end
how to export timeOut variable in JS
I'm making a Js memory game using express and mongoose
function incrementAttempts(){
attempts++;
attemptsHolder.textContent = attempts;

}


// Function to check if the chosen cards match
function checkForMatch() {
const [card1, card2] = chosenCards;
const [cardId1, cardId2] = chosenCardsIds;

// If the cards match, update foundCards count and display
if (card1 === card2) {
foundCards += 2;
foundHolder.textContent = foundCards;
if (foundCards === cardsInGame) {
// const final = attempts;
setTimeout(()=>{
console.log(attempts);
alert(`Congratulations! You found all the pairs in ${attempts} attempts.`);
},0);

}
} else {
// If the cards don't match, flip them back
document.querySelector(`[data-id="${cardId1}"]`).textContent = '';
document.querySelector(`[data-id="${cardId2}"]`).textContent = '';
}

// Clear the chosen cards arrays
chosenCards = [];
chosenCardsIds = [];

// Increase attempts count and display
incrementAttempts()
}
function incrementAttempts(){
attempts++;
attemptsHolder.textContent = attempts;

}


// Function to check if the chosen cards match
function checkForMatch() {
const [card1, card2] = chosenCards;
const [cardId1, cardId2] = chosenCardsIds;

// If the cards match, update foundCards count and display
if (card1 === card2) {
foundCards += 2;
foundHolder.textContent = foundCards;
if (foundCards === cardsInGame) {
// const final = attempts;
setTimeout(()=>{
console.log(attempts);
alert(`Congratulations! You found all the pairs in ${attempts} attempts.`);
},0);

}
} else {
// If the cards don't match, flip them back
document.querySelector(`[data-id="${cardId1}"]`).textContent = '';
document.querySelector(`[data-id="${cardId2}"]`).textContent = '';
}

// Clear the chosen cards arrays
chosenCards = [];
chosenCardsIds = [];

// Increase attempts count and display
incrementAttempts()
}
i want to get hold of the attempts variable in setTimout alert. Can i export it into another js file?? Beacuse mainly i want to push that attempts variable in MonogoDB
6 replies
KPCKevin Powell - Community
Created by JOY on 10/10/2023 in #back-end
Not able to do import export functions in node.js project
I'm making a memory game, I want to export a function. logic.js
function incrementAttempts(){
attempts++;
attemptsHolder.textContent = attempts;
}
//Other functions-----

module.exports = {incrementAttempts}
function incrementAttempts(){
attempts++;
attemptsHolder.textContent = attempts;
}
//Other functions-----

module.exports = {incrementAttempts}
app.js
const incrementAttempts = require('./public/logic');
const incrementAttempts = require('./public/logic');
the app is keep crashing, i tried changing type to module in package.json, there was still no change
9 replies
KPCKevin Powell - Community
Created by JOY on 8/23/2023 in #ui-ux
different background color when deployed on Vercel
No description
3 replies
KPCKevin Powell - Community
Created by JOY on 8/16/2023 in #front-end
Help with svelte component in astro
No description
7 replies
KPCKevin Powell - Community
Created by JOY on 8/12/2023 in #ui-ux
Suggest some changes
https://www.napud.org/ I want to redesign the website Can you guys suggest some changes on the website, I know it should have a better UI and all, a good color scheme ig, anything else?
3 replies
KPCKevin Powell - Community
Created by JOY on 8/2/2023 in #front-end
how can i apply the grid effect in tailwind
58 replies
KPCKevin Powell - Community
Created by JOY on 8/2/2023 in #front-end
astro-podcast website. How to make more episodes keep showing up as you scroll
How can I implement this effect: Eg: https://hubermanlab.com/ (The podcast episodes keep showing up as you scroll.) The Spotify api fetches only 20 episodes.
7 replies
KPCKevin Powell - Community
Created by JOY on 7/24/2023 in #front-end
How can I make variables from 1 file present in another
22 replies
KPCKevin Powell - Community
Created by JOY on 7/20/2023 in #front-end
How can I make calls to spotify api- I want to get episodes listed of a podcast.
There is a problem related to bearer token. I dont even know how to start writing the code
26 replies
KPCKevin Powell - Community
Created by JOY on 6/24/2023 in #front-end
I have to create a podcast website for someone, they have like 100+ episodes.
How can I create a separate page for each episode? I don't want to make 100s of pages manually. Is there any ez way?
21 replies
KPCKevin Powell - Community
Created by JOY on 5/19/2023 in #front-end
I don't understand this 1 line in the svelte code
Ignore the comments. Why numbers=numbers is used in the function <script> let numbers = [1, 2, 3, 4]; function addNumber() { // numbers = [...numbers, numbers.length+1]; //numbers[numbers.length] = numbers.length+1 numbers.push(numbers.length + 1); numbers = numbers; } $: sum = numbers.reduce((t, n) => t + n, 0); </script> <p>{numbers.join(' + ')} = {sum}</p> <button on:click={addNumber}> Add a number </button>
3 replies
KPCKevin Powell - Community
Created by JOY on 5/16/2023 in #front-end
My html is getting very extensive, is there any way I can split it like react components
Trying to develop a complex application.
77 replies
KPCKevin Powell - Community
Created by JOY on 11/6/2022 in #front-end
How can I show HTML code snippet on webpage
9 replies
KPCKevin Powell - Community
Created by JOY on 10/24/2022 in #front-end
I want to copy this STRIPE’s embeddable pricing table feature.
FOR INFO: There is a stripe embeddable pricing table feature In it, First, we finish designing the pricing table. Then, It spits out a code (a script tag), that we can embed in our HTML. For like, I have a pricing page template that you want to use, and I just want you to use this little code to embed this pricing page template in your code. How can I generate this “script and stripe-pricing-table tag”? I don't know if I’m clear or not I tried my best to explain it.
8 replies