question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught TypeError: exists is not a function

See original GitHub issue

I’m trying to include node-ffi in a simple webpack app.

Uncaught TypeError: exists is not a function
    at Function.getRoot (bundle.js:19867)
    at bindings (bundle.js:19769)
    at Object.<anonymous> (bundle.js:3045)
    at Object.<anonymous> (bundle.js:4503)
    at __webpack_require__ (bundle.js:1303)
    at fn (bundle.js:726)
    at Object.exports.byteLength (bundle.js:39099)
    at __webpack_require__ (bundle.js:1303)
    at fn (bundle.js:726)
    at Object.<anonymous> (bundle.js:39072)

I’m fairly certain this is because of an earlier problem I was having with webpack:

ERROR in ./node_modules/ffi/node_modules/bindings/bindings.js
Module not found: Error: Can't resolve 'fs' in '/Users/ethan/Projects/PolyWrite/node_modules/ffi/node_modules/bindings'
 @ ./node_modules/ffi/node_modules/bindings/bindings.js 6:9-22
 @ ./node_modules/ffi/lib/bindings.js
 @ ./node_modules/ffi/lib/ffi.js
 @ ./javascript/app/components/Header.js
 @ ./javascript/app/App.js
 @ ./javascript/start.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./javascript/start.js ./styles/main.scss

ERROR in ./node_modules/ffi/node_modules/ref/node_modules/bindings/bindings.js
Module not found: Error: Can't resolve 'fs' in '/Users/ethan/Projects/PolyWrite/node_modules/ffi/node_modules/ref/node_modules/bindings'
 @ ./node_modules/ffi/node_modules/ref/node_modules/bindings/bindings.js 6:9-22
 @ ./node_modules/ffi/node_modules/ref/lib/ref.js
 @ ./node_modules/ffi/lib/ffi.js
 @ ./javascript/app/components/Header.js
 @ ./javascript/app/App.js
 @ ./javascript/start.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./javascript/start.js ./styles/main.scss

My solution to this was to add these lines to the webpack.config.js:

node: {
  fs: 'empty',
},

So now I don’t know where to go from here. I appreciate any help.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
EthanBogartcommented, Sep 18, 2017

It eventually ended up running when I tried it without webpack. I don’t think they work very well together, unfortunately. Good luck!

0reactions
naveed-31commented, Jun 12, 2019

whats the solution of this ? i am also having this issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: exists is not a function #1501 - GitHub
I just imported sharp in my react project then it returns this error Uncaught TypeError: exists is not a function Function.
Read more >
exists is not a function when attempting to use serial port in ...
1 Answer 1 · I take this mistake : Uncaught TypeError: exists is not a function at Function. · are you calling a...
Read more >
Uncaught TypeError: exists is not a function - Google Groups
when working with modules Ceylon from JavaScript the program is running normally but in the console occurs error: Uncaught TypeError: exists is not...
Read more >
How to Handle JavaScript Uncaught TypeError: “x” is Not a ...
The Javascript TypeError: "x" is not a function occurs when calling a function on a value or object, which is not actually a...
Read more >
TypeError: exists not a function - help - Meteor forums
I just started getting this error, it's breaking my routing but I'm not sure where I need to start looking for troubleshooting it,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found