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
[Bug] Can't resolve 'fs' #464
Comments
Hi @hluo-alt, please add the following config to
Casbin examples: https://github.com/node-casbin/casbin-examples |
Thank you @nodece |
Buffer is built-in library for the Node.js project. In the Web, you can install this library by “yarn add buffer”. |
Thanks, in addition to installing Buffer, I added import * as Buffer from 'node_modules/buffer';
(window as any).Buffer = Buffer.Buffer; in |
For people using vite, the plugin The following import { defineConfig } from 'vite';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
nodePolyfills({
globals: { Buffer: true },
}),
],
// other config
}) |
The issue
When I try to import the Casbin Enforcer, it gives this error:
I am using Casbin in node.js with node version
v16.17.0
and Angular versionv14
.Desktop:
The text was updated successfully, but these errors were encountered: