-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
ERROR [worker reload] [worker init] /home/luckyloo/WebstormProjects/SurfMarket/.nuxt/dev/index.mjs failed 11:42:28 AM #29943
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Environment
- Operating System: Linux
- Node Version: v18.1.0
- Nuxt Version: 3.14.159
- CLI Version: 3.15.0
- Nitro Version: 2.10.4
- Package Manager: [email protected]
- Builder: -
- User Config: default
- Runtime Modules: -
- Build Modules: -
Reproduction
import bcrypt from 'bcrypt';
import { pool } from '~/server/db';
export default defineEventHandler(async (event) => {
const { username, password } = await readBody(event);
// Validate input
if (!username || !password) {
throw createError({
statusCode: 400,
message: 'Username and password are required',
});
}
try {
// Check if the username already exists
const [rows] = await pool.query('SELECT username FROM users WHERE username = ?', [username]);
if (rows.length > 0) {
throw createError({
statusCode: 400,
message: 'Username is already taken',
});
}
// Hash the password
const hashedPassword = await bcrypt.hash(password, 10);
// Insert the new user into the database
await pool.query('INSERT INTO users (username, password) VALUES (?, ?)', [username, hashedPassword]);
return { message: 'User registered successfully!' };
} catch (err) {
throw createError({
statusCode: 500,
message: 'Database error: ' + err.message,
});
}
});
Describe the bug
At one point, I just get an error message when I started Nuxt. I was working on adding a database to my website for an auth system.
ERROR [worker reload] [worker init] /home/luckyloo/WebstormProjects/SurfMarket/.nuxt/dev/index.mjs failed 11:42:28 AM
Additional context
I've tried to update npm, nuxt, reinstalling packages, recreating .nuxt directory. Didn't help, I still get this error.
Logs
Reactions are currently unavailable