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

After ejecting getting "process.binding is not supported" error #815

Closed
brakowski opened this issue Oct 1, 2016 · 23 comments
Closed

After ejecting getting "process.binding is not supported" error #815

brakowski opened this issue Oct 1, 2016 · 23 comments

Comments

@brakowski
Copy link

brakowski commented Oct 1, 2016

Description

After ejecting a newly created app, and try to open it in the browser, i get a "Uncaught Error: process.binding is not supported" in the browser.

Expected behavior

It should work the same like before ejecting.

Actual behavior

An "Uncaught Error: process.binding is not supported" error is displayed in the browser console.

Environment

  1. Operating system: Linux Mint 17 Qiana
  2. Browser and version: Google Chrome 47.0.2526.111 (64-bit)
  3. Node: v6.2.1
  4. NPM: 2.11.3

    Reproducible Demo

  • create-react-app test-app
  • cd test-app
  • npm run eject
  • npm start

Seems like "usr/lib/nodejs" is also bundled by webpack. The whole error message:

Uncaught Error: process.binding is not supportedprocess.binding
@ browser.js:173(anonymous function)
@ buffer.js:4(anonymous function)
@ buffer.js:1293__webpack_require__
@ bootstrap e7633f287f581d8681cb:555fn
@ bootstrap e7633f287f581d8681cb:86(anonymous function)
@ querystring.js:6__webpack_require__
@ bootstrap e7633f287f581d8681cb:555fn
@ bootstrap e7633f287f581d8681cb:86(anonymous function)
@ url.js:61__webpack_require__
@ bootstrap e7633f287f581d8681cb:555fn
@ bootstrap e7633f287f581d8681cb:86(anonymous function)
@ webpackHotDevClient.js:22__webpack_require__
@ bootstrap e7633f287f581d8681cb:555fn
@ bootstrap e7633f287f581d8681cb:86(anonymous function)
@ bootstrap e7633f287f581d8681cb:578__webpack_require__
@ bootstrap e7633f287f581d8681cb:555(anonymous function)
@ bootstrap e7633f287f581d8681cb:578(anonymous function)
@ bootstrap e7633f287f581d8681cb:578

@amilajack
Copy link

amilajack commented Oct 1, 2016

Try updating your npm version to the latest version

npm cache clean
npm i -g npm

It could have to do with how some dependencies have not been installed correctly.

@brakowski
Copy link
Author

brakowski commented Oct 1, 2016

But it works without ejecting.

Edit: cache clean and update of npm did not solve the issue

@gaearon
Copy link
Contributor

gaearon commented Oct 1, 2016

Can you reliably reproduce it with absolutely new app?

@gaearon
Copy link
Contributor

gaearon commented Oct 1, 2016

Okay, this stack trace is super valuable.

Looks like this has something to do with webpackHotDevClient pulling in url pulling in querystring pulling in some sort of broken Buffer polyfill.

Can anybody else reproduce this?

@brakowski
Copy link
Author

Yes i just now tried again. Did start the server before ejecting and it works fine, after ejecting the above mentioned error is thrown.

@brakowski
Copy link
Author

Ok found it out, adding 'url' as devDependency solves the issue.

@gaearon gaearon added this to the 0.7.0 milestone Oct 2, 2016
@gaearon
Copy link
Contributor

gaearon commented Oct 2, 2016

This is weird. Our end-to-end test runs start after eject on npm 2.15.9, and Travis log seems fine.

I also can’t reproduce it locally with npm 3, although it’s worth trying with your specific version:

screen shot 2016-10-02 at 13 18 30

@gaearon
Copy link
Contributor

gaearon commented Oct 2, 2016

Please post output of:

npm ls url
npm ls querystring
npm ls buffer

after running in the ejected project in broken state.

@brakowski
Copy link
Author

npm ls url

test-app@0.1.0 
└─┬ webpack@1.13.2
  └─┬ node-libs-browser@0.6.0
    └── url@0.10.3

npm ls querystring

test-app@0.1.0
└─┬ webpack@1.13.2
  └─┬ node-libs-browser@0.6.0
    └─┬ url@0.10.3
      └── querystring@0.2.0 

npm ls buffer

test-app@0.1.0
└─┬ webpack@1.13.2
  └─┬ node-libs-browser@0.6.0
    └── buffer@4.9.1

After installing url:

npm ls url

test-app@0.1.0
├── url@0.11.0 
└─┬ webpack@1.13.2
  └─┬ node-libs-browser@0.6.0
    └── url@0.10.3

npm ls querystring

test-app@0.1.0
├─┬ url@0.11.0
│ └── querystring@0.2.0 
└─┬ webpack@1.13.2
  └─┬ node-libs-browser@0.6.0
    └─┬ url@0.10.3
      └── querystring@0.2.0

Buffer stays the same.

@gaearon
Copy link
Contributor

gaearon commented Oct 3, 2016

I likely won’t have time to dive into this soon, so for now please use the "add url to devDependencies" workaround.

I would appreciate if somebody could dive into why this happens and tried to reproduce it with your npm version.

@NessDan
Copy link

NessDan commented Oct 12, 2016

@brakowski thank you, the url dependency fixed it.

I was having the same issue on Ubuntu 15.10, node v6.3.1, npm v3.10.8

@fson fson modified the milestones: 1.0.0, 0.7.0 Oct 12, 2016
@maxoux
Copy link

maxoux commented Nov 3, 2016

I have same issue, but the url dependency did not solve the issue...
npm: 3.8.6
node: 6.1.0
OS : Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux

npm ls url

├── url@0.11.0 
└─┬ webpack@1.13.2
  └─┬ node-libs-browser@0.6.0
    └── url@0.10.3 

npm ls querystring

└─┬ url@0.11.0
  └── querystring@0.2.0 

npm ls buffer

└─┬ webpack@1.13.2
  └─┬ node-libs-browser@0.6.0
    └── buffer@4.9.1

i have this issue with this computer, and a computer's coworker on ubuntu.
But my laptop work fine, on same version of debian.

@sirreal
Copy link

sirreal commented Nov 30, 2016

I experienced this issue and mistakenly attributed it to a module I was using. My project was not ejected. See: rjsf-team/react-jsonschema-form#321

My workaround was to build my app inside a disposable container.

@gaearon
Copy link
Contributor

gaearon commented Nov 30, 2016

I wonder if it's the same problem as #1023.

@ghost
Copy link

ghost commented Nov 30, 2016

I am experiencing this same error message after installing a different module, auth0-lock (https://github.com/auth0/lock). I have not ejected my project, but I found others were experiencing the same error message, such as @sirreal , and as mentioned at #587. I saw that this issue is still open, while those other ones are closed, so I've decided to post about my experience here.

npm: 3.10.8
node: 6.9.1
os: Ubuntu 16.04 LTS

I ran npm cache clean and npm i -g npm. I also added url as a dependency, blew away my node_modules dir and re-ran npm install, but none of those fixed the problem, although my error stack trace is shorter:

Uncaught Error: process.binding is not supported
    at Object.process.binding (webpack:///./~/react-scripts/~/process/browser.js?:173:11)
    at Object.eval (webpack:////usr/lib/nodejs/util.js?:3:20)
    at eval (webpack:////usr/lib/nodejs/util.js?:942:30)
    at Object.<anonymous> (http://localhost:3000/static/js/bundle.js:3784:2)
    at __webpack_require__ (http://localhost:3000/static/js/bundle.js:556:30)
    at fn (http://localhost:3000/static/js/bundle.js:87:20)
    at eval (webpack:///./~/auth0-lock/lib/i18n.js?:20:13)
    at Object.<anonymous> (http://localhost:3000/static/js/bundle.js:4342:2)
    at __webpack_require__ (http://localhost:3000/static/js/bundle.js:556:30)
    at fn (http://localhost:3000/static/js/bundle.js:87:20)

Thought I'd post in case these are all related and it could help fix this issue! ¯_(ツ)_/¯

@ghost
Copy link

ghost commented Nov 30, 2016

@gaearon Should I post my message above in #1023? Or do y'all have a pretty good idea what's going on already? I scanned that issue, but it's a bit above my head ;P. Also, it may be worth noting that just requiring auth0-lock module breaks it. Finally, I'm in a room of 12 people and everyone else has a Mac and are not running into this issue.

@gaearon
Copy link
Contributor

gaearon commented Nov 30, 2016

No, nobody has any idea why it happens.
We really need help there.

Yes, please cross-post because that thread is bigger.

So far it is only reproducible on Ubuntu, never on OS X.

@ghost
Copy link

ghost commented Nov 30, 2016

@gaearon Done!
@sirreal Another work around (other than running in a container), would be to identify which node module is falling back to the native copy and add it as a direct dependency in your node_modules. See the latest comments in #1023.

@gaearon gaearon modified the milestones: 0.8.2, 1.0.0 Dec 7, 2016
@gaearon
Copy link
Contributor

gaearon commented Dec 7, 2016

Fixed in #1194.

@gaearon gaearon closed this as completed Dec 7, 2016
@SkyHustle
Copy link

SkyHustle commented Dec 7, 2016

I did not use create-react-app to build my project but this is the only relevant thread to my particular case. I'm using the Firebase Admin SDK and as soon as I import * as admin from 'firebase-admin' I get this same error on the client bundle.js:1048 Uncaught Error: process.binding is not supported

I've tried everything in this thread and it still won't go away, any insight would be appreciated!? I'm kinda desperate at this point :(

Could someone at least explain what exactly is process and what is the method binding that's being called on process? Since this is a webpack issue maybe I can require Firebase Admin SDK without the use of webpack? If so, how would I go about doing this?

@gaearon
Copy link
Contributor

gaearon commented Dec 7, 2016

@Dmitry1007

Have you seen my summary in #1194 (comment)? This likely means a Node.js module somehow ends up in your build instead of Webpack's shim.

@gaearon
Copy link
Contributor

gaearon commented Dec 7, 2016

Or perhaps process.binding is part of the shim (most likely) but some module you're importing assumes it's running in Node.js and relies on features not implemented by Webpack's shim.

Are you confident https://www.npmjs.com/package/firebase-admin is supporting being run from browser environments?

@gaearon
Copy link
Contributor

gaearon commented Dec 7, 2016

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

No branches or pull requests

8 participants