Jure
Jure
Explore posts from servers
NNuxt
Created by Jure on 8/22/2024 in #❓・help
Nuxt Image: IPX_FILE_NOT_FOUND
I have installed Nuxt Image module which works fine in dev mode, but not on production server. Production server is Ubuntu / Nginx. https://domain.com/_ipx/w_32/images/32955/i.jpg
{
"error": {
"message": "[404] [IPX_FILE_NOT_FOUND] File not found: /images/32955/i.jpg"
}
}
{
"error": {
"message": "[404] [IPX_FILE_NOT_FOUND] File not found: /images/32955/i.jpg"
}
}
File exists on the server:
ls -l public/images/32955/i.jpg
-rw-rw-r-- 1 hub hub 15054 Apr 18 14:06 public/images/32955/i.jpg
ls -l public/images/32955/i.jpg
-rw-rw-r-- 1 hub hub 15054 Apr 18 14:06 public/images/32955/i.jpg
I guess this is not problem with Nginx config since I get response from the IPX. Looks more like IPX can't find image on the server... or is looking for it on the wrong path. Any help debugging this would be much appreciated!
2 replies
DTDrizzle Team
Created by Jure on 3/14/2024 in #help
How to use JSON column type?
Hi. I'm new to Drizzle and 'm strugling with JSON column type. Here is the example:
interface Translation {
__: string
hr?: string
cs?: string
de?: string
en?: string
}

// table schema
export const nodes = mysqlTable('nodes', {
// ...
name: json('value').$type<Translation>().notNull(),
// ...
}

// inserting JSON
await db.insert(models.nodes)
.values({
//...
// node.name = {
// "__": "Moda",
// "hr": "Moda",
// "cs": "Móda",
// "en": "Fashion",
// "de": "Mode"
// }
name: node.name
//...
})
interface Translation {
__: string
hr?: string
cs?: string
de?: string
en?: string
}

// table schema
export const nodes = mysqlTable('nodes', {
// ...
name: json('value').$type<Translation>().notNull(),
// ...
}

// inserting JSON
await db.insert(models.nodes)
.values({
//...
// node.name = {
// "__": "Moda",
// "hr": "Moda",
// "cs": "Móda",
// "en": "Fashion",
// "de": "Mode"
// }
name: node.name
//...
})
So far everything looks good. But I'm confused when selecting the JSON column name;
// selecting JSON
const nodes = await db.select().from(models.nodes)

// this is valid typescript code but is always undefined.
console.log(nodes[0].name.en)

// this is not valid typescript code, but works.
console.log(JSON.parse(nodes[0].name).en)
// selecting JSON
const nodes = await db.select().from(models.nodes)

// this is valid typescript code but is always undefined.
console.log(nodes[0].name.en)

// this is not valid typescript code, but works.
console.log(JSON.parse(nodes[0].name).en)
So the problem is that I get nice typescript support when selecting JSON column, because type is passed to json().$type<>, but selected "name" is just a string which need to be parsed. What am I missing?
2 replies
NNuxt
Created by Jure on 3/9/2024 in #❓・help
How to run Nitro task in Nuxt using cli?
How could I run Nitro taks using cli? I'm following docs and using command: pnpm exec nitro task list But I get this error: Missing info file: .nitro/nitro.json (is dev server running?) Dev server is running... But I guess in Nuxt project different path for nitro.json should be used?
2 replies
DTDrizzle Team
Created by Jure on 2/29/2024 in #help
MySQL select().from() type
No description
5 replies
NNuxt
Created by Jure on 2/27/2024 in #❓・help
pnpm error when creating new project
Every time I'm creating a new Nuxt project with pnpm: pnpm dlx nuxi@latest init <project-name> I'm asked: Which package manager would you like to use? pnpm And then I get an error:
◐ Installing dependencies...
Usage Error: This project is configured to use yarn
$ pnpm ...
ERROR Error: Command failed with exit code 1: corepack pnpm install
◐ Installing dependencies...
Usage Error: This project is configured to use yarn
$ pnpm ...
ERROR Error: Command failed with exit code 1: corepack pnpm install
After that I just manually run pnpm install and all dependencies are successfully installed. But I would still like to get rid of the error... 🙂
1 replies
CDCloudflare Developers
Created by Jure on 9/19/2023 in #pages-help
Is possible to run migrations in Pages build command?
I'm not sure what is the right flow to run D1 migrations... If I understand it correctly so far, you have to: Push migrations with a command: npx wrangler d1 migrations apply db-name as a wrangler command from the local env to make changes in the prod. DB and then push the changed app code (wich rely on new DB schema) to git. Shouldn't be a migration run right after the deployment in the "build command" like: npm run build && npx wrangler d1 migrations apply db-name Is this possible? I tried the comamnd and got the error:
In a non-interactive environment, it's necessary to set a CLOUDFLARE_API_TOKEN environment variable for wrangler to work. Please go to https://developers.cloudflare.com/fundamentals/api/get-started/create-token/ for instructions on how to create an api token, and assign its value to CLOUDFLARE_API_TOKEN.
In a non-interactive environment, it's necessary to set a CLOUDFLARE_API_TOKEN environment variable for wrangler to work. Please go to https://developers.cloudflare.com/fundamentals/api/get-started/create-token/ for instructions on how to create an api token, and assign its value to CLOUDFLARE_API_TOKEN.
After creating CLOUDFLARE_API_TOKEN env var I get this error:
Failed: Error while executing user command. Exited with error code: 1
Failed: build command exited with code: 1
Failed: error occurred while running build command
Failed: Error while executing user command. Exited with error code: 1
Failed: build command exited with code: 1
Failed: error occurred while running build command
6 replies
NNuxt
Created by Jure on 2/6/2023 in #❓・help
Why is updating Nuxt causing Vuetify error?
After updating Nuxt from 3.0.0. to 3.1.2 Vuetify is throwing an error:
ERROR [unhandledRejection] Failed to resolve entry for package "vuetify". The package may have incorrect main/module/exports specified in its package.json. 01:16:52

at packageEntryFailure (node_modules/vite/dist/node/chunks/dep-3007b26d.js:22004:11)
at resolvePackageEntry (node_modules/vite/dist/node/chunks/dep-3007b26d.js:22001:5)
at tryNodeResolve (node_modules/vite/dist/node/chunks/dep-3007b26d.js:21736:20)
at Context.resolveId (node_modules/vite/dist/node/chunks/dep-3007b26d.js:21487:28)
at Object.resolveId (node_modules/vite/dist/node/chunks/dep-3007b26d.js:41587:46)
at async Object.<anonymous> (node_modules/vite/dist/node/chunks/dep-3007b26d.js:61953:21)
ERROR [unhandledRejection] Failed to resolve entry for package "vuetify". The package may have incorrect main/module/exports specified in its package.json. 01:16:52

at packageEntryFailure (node_modules/vite/dist/node/chunks/dep-3007b26d.js:22004:11)
at resolvePackageEntry (node_modules/vite/dist/node/chunks/dep-3007b26d.js:22001:5)
at tryNodeResolve (node_modules/vite/dist/node/chunks/dep-3007b26d.js:21736:20)
at Context.resolveId (node_modules/vite/dist/node/chunks/dep-3007b26d.js:21487:28)
at Object.resolveId (node_modules/vite/dist/node/chunks/dep-3007b26d.js:41587:46)
at async Object.<anonymous> (node_modules/vite/dist/node/chunks/dep-3007b26d.js:61953:21)
This is my test project: https://codesandbox.io/p/github/juretopolak/nuxt3-tailwind-vuetify/nuxt-update?file=%2FREADME.md Anyone knows what is the issue here?
2 replies
NNuxt
Created by Jure on 2/3/2023 in #❓・help
Error after upgrading Nuxt
No description
8 replies
NNuxt
Created by Jure on 1/17/2023 in #❓・help
What is nuxt.isNuxtApp in VSCode settings.json?
No description
2 replies
NNuxt
Created by Jure on 12/17/2022 in #❓・help
ESLint required dependencies
Following instructions here: https://github.com/nuxt/eslint-config I have installed the package with: yarn add -D @nuxtjs/eslint-config-typescript eslint And then added script: "lint": "eslint ." in package.json When running "yarn lint" I get this error... Error: Failed to load plugin '@typescript-eslint' declared in '.eslintrc » @nuxtjs/eslint-config-typescript': Cannot find module 'typescript' I have installed "yarn add -D typescript" which solved the problem... But I'm curious... is it okay to have typescript again here as a dependency?
11 replies