Next.js Discord

Discord Forum

Module not found : 'fs'

Answered
Pacific sand lance posted this in #help-forum
Open in Discord
Pacific sand lanceOP
anyone know what caused this while using bcrypt?
Module not found: Can't resolve 'fs'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/@mapbox/node-pre-gyp/lib/ sync ^\.\/.*$
./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js
./node_modules/bcrypt/bcrypt.js
Answered by DirtyCajunRice | AppDir
client doesnt have fs
View full answer

8 Replies

where is the code.
edge doesnt have fs
Pacific sand lanceOP
hold up
@DirtyCajunRice | AppDir where is the code.
Pacific sand lanceOP
'use client'
import bcrypt from 'bcrypt';

const [password, setPassword] = useState("")
const saltRounds = 10;
        const hashedPassword = bcrypt.hash(password, saltRounds);
Answer
Pacific sand lanceOP
ah okay
but if i move the hashing in to a route.js, would it work?
as long as you dont use edge instead of node yes