Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: Can't resolve 'fs' #28

Open
ray040237 opened this issue Mar 27, 2024 · 1 comment
Open

Module not found: Can't resolve 'fs' #28

ray040237 opened this issue Mar 27, 2024 · 1 comment

Comments

@ray040237
Copy link

你好,按照教程运行 yarn dev ,出现以下错误:
⨯ ./node_modules/@kwsites/file-exists/dist/src/index.js:6:13
Module not found: Can't resolve 'fs'

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

Import trace for requested module:
./node_modules/@kwsites/file-exists/dist/index.js
./node_modules/simple-git/dist/esm/index.js
./node_modules/node-llama-cpp/dist/utils/cloneLlamaCppRepo.js
./node_modules/node-llama-cpp/dist/utils/getReleaseInfo.js
./node_modules/node-llama-cpp/dist/index.js
./node_modules/@langchain/community/dist/utils/llama_cpp.js
./node_modules/@langchain/community/dist/llms/llama_cpp.js
./node_modules/@langchain/community/llms/llama_cpp.js
./app/api/chat/route.ts
./node_modules/next/dist/build/webpack/loaders/next-edge-app-route-loader/index.js?absolutePagePath=D%3A%5Cjs%5Clangchain-nextjs-template-main%5Capp%5Capi%5Cchat%5Croute.ts&page=%2Fapi%2Fchat%2Froute&appDirLoader=bmV4dC1hcHAtbG9hZGVyP25hbWU9YXBwJTJGYXBpJTJGY2hhdCUyRnJvdXRlJnBhZ2U9JTJGYXBpJTJGY2hhdCUyRnJvdXRlJmFwcFBhdGhzPSZwYWdlUGF0aD1wcml2YXRlLW5leHQtYXBwLWRpciUyRmFwaSUyRmNoYXQlMkZyb3V0ZS50cyZhcHBEaXI9RCUzQSU1Q2pzJTVDbGFuZ2NoYWluLW5leHRqcy10ZW1wbGF0ZS1tYWluJTVDYXBwJnBhZ2VFeHRlbnNpb25zPXRzeCZwYWdlRXh0ZW5zaW9ucz10cyZwYWdlRXh0ZW5zaW9ucz1qc3gmcGFnZUV4dGVuc2lvbnM9anMmcm9vdERpcj1EJTNBJTVDanMlNUNsYW5nY2hhaW4tbmV4dGpzLXRlbXBsYXRlLW1haW4maXNEZXY9dHJ1ZSZ0c2NvbmZpZ1BhdGg9dHNjb25maWcuanNvbiZiYXNlUGF0aD0mYXNzZXRQcmVmaXg9Jm5leHRDb25maWdPdXRwdXQ9JnByZWZlcnJlZFJlZ2lvbj0mbWlkZGxld2FyZUNvbmZpZz1lMzAlM0Qh&nextConfigOutput=&preferredRegion=&middlewareConfig=e30%3D!

请问如何解决?

@chadfaurie
Copy link

check if ./app/api/chat/route.ts has export const runtime = "edge";

This would prevent access to the full node runtime, see this doc: https://nextjs.org/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants