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

Getting Uncaught ReferenceError when using nsfwjs.load() #762

Open
talisraeli opened this issue Jun 16, 2023 · 1 comment
Open

Getting Uncaught ReferenceError when using nsfwjs.load() #762

talisraeli opened this issue Jun 16, 2023 · 1 comment

Comments

@talisraeli
Copy link

talisraeli commented Jun 16, 2023

I'm getting an error of process is not defined when using nsfwjs.load("/model/", { size: 299 }) on my ReactJS app.
Seems to be an error in the library... (version: 2.4.2)
It doesn't change the error message if I change the function parameters.

util.js:109 Uncaught ReferenceError: process is not defined
    at node_modules/util/util.js (util.js:109:1)
    at __require2 (chunk-TFWDKVI3.js?v=166c4fc5:18:50)
    at node_modules/assert/build/internal/assert/assertion_error.js (assertion_error.js:35:16)
    at __require2 (chunk-TFWDKVI3.js?v=166c4fc5:18:50)
    at node_modules/assert/build/assert.js (assert.js:36:22)
    at __require2 (chunk-TFWDKVI3.js?v=166c4fc5:18:50)
    at node_modules/gif-encoder/lib/GIFEncoder.js (GIFEncoder.js:11:14)
    at __require2 (chunk-TFWDKVI3.js?v=166c4fc5:18:50)
    at node_modules/@nsfw-filter/save-pixels/save-pixels.js (save-pixels.js:3:18)
    at __require2 (chunk-TFWDKVI3.js?v=166c4fc5:18:50)
node_modules/util/util.js @ util.js:109
__require2 @ chunk-TFWDKVI3.js?v=166c4fc5:18
node_modules/assert/build/internal/assert/assertion_error.js @ assertion_error.js:35
__require2 @ chunk-TFWDKVI3.js?v=166c4fc5:18
node_modules/assert/build/assert.js @ assert.js:36
__require2 @ chunk-TFWDKVI3.js?v=166c4fc5:18
node_modules/gif-encoder/lib/GIFEncoder.js @ GIFEncoder.js:11
__require2 @ chunk-TFWDKVI3.js?v=166c4fc5:18
node_modules/@nsfw-filter/save-pixels/save-pixels.js @ save-pixels.js:3
__require2 @ chunk-TFWDKVI3.js?v=166c4fc5:18
node_modules/@nsfw-filter/gif-frames/gif-frames.js @ gif-frames.js:3
__require2 @ chunk-TFWDKVI3.js?v=166c4fc5:18
node_modules/nsfwjs/dist/index.js @ index.js:64
__require2 @ chunk-TFWDKVI3.js?v=166c4fc5:18
(anonymous) @ index.js:301
@talisraeli talisraeli changed the title Getting Uncaught ReferenceError when using nsfwjs.load() Getting Uncaught ReferenceError when using nsfwjs.load() Jun 16, 2023
@talisraeli
Copy link
Author

talisraeli commented Jun 16, 2023

This error message isn't shown anymore if I define these configurations in vite.config.ts:

define: {
    "process.env.NODE_DEBUG": JSON.stringify(process.env.NODE_DEBUG),
    Buffer: ["buffer", "Buffer"],
},

But now, this error is shown:

inherits_browser.js:6 Uncaught TypeError: Object prototype may only be an Object or null: undefined
    at Function.create (<anonymous>)
    at Object.inherits (inherits_browser.js:6:31)
    at node_modules/gif-encoder/node_modules/readable-stream/lib/_stream_readable.js (_stream_readable.js:63:6)
    at __require2 (chunk-TFWDKVI3.js?v=ea788f6a:18:50)
    at node_modules/gif-encoder/node_modules/readable-stream/readable.js (readable.js:1:28)
    at __require2 (chunk-TFWDKVI3.js?v=ea788f6a:18:50)
    at node_modules/gif-encoder/lib/GIFEncoder.js (GIFEncoder.js:13:22)
    at __require2 (chunk-TFWDKVI3.js?v=ea788f6a:18:50)
    at node_modules/@nsfw-filter/save-pixels/save-pixels.js (save-pixels.js:3:18)
    at __require2 (chunk-TFWDKVI3.js?v=ea788f6a:18:50)
inherits @ inherits_browser.js:6
node_modules/gif-encoder/node_modules/readable-stream/lib/_stream_readable.js @ _stream_readable.js:63
__require2 @ chunk-TFWDKVI3.js?v=ea788f6a:18
node_modules/gif-encoder/node_modules/readable-stream/readable.js @ readable.js:1
__require2 @ chunk-TFWDKVI3.js?v=ea788f6a:18
node_modules/gif-encoder/lib/GIFEncoder.js @ GIFEncoder.js:13
__require2 @ chunk-TFWDKVI3.js?v=ea788f6a:18
node_modules/@nsfw-filter/save-pixels/save-pixels.js @ save-pixels.js:3
__require2 @ chunk-TFWDKVI3.js?v=ea788f6a:18
node_modules/@nsfw-filter/gif-frames/gif-frames.js @ gif-frames.js:3
__require2 @ chunk-TFWDKVI3.js?v=ea788f6a:18
node_modules/nsfwjs/dist/index.js @ index.js:64
__require2 @ chunk-TFWDKVI3.js?v=ea788f6a:18
(anonymous) @ index.js:301

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

1 participant