create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

Bug: Can't import PubNub package

Open Ethorsen opened this issue 6 years ago • 1 comments

Is this a bug report?

Yes

Did you try recovering your dependencies?

Yes

Environment

Environment Info:

System: OS: Windows 10 CPU: (8) x64 Intel(R) Xeon(R) CPU E3-1245 v5 @ 3.50GHz Binaries: Node: 12.9.1 - E:\nodejs\node.EXE Yarn: 1.17.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.10.2 - E:\nodejs\npm.CMD Browsers: Edge: 41.16299.248.0 Internet Explorer: 11.0.16299.15 npmPackages: react: ^16.9.0 => 16.9.0 react-dom: ^16.9.0 => 16.9.0 react-scripts: Not Found npmGlobalPackages: create-react-app: Not Found

Steps to Reproduce

  1. yarn create react-app --scripts-version @react-workspaces/react-scripts test
  2. cd test && yarn add pubnub
  3. vi src/App.js
  4. Add import pubnub from "pubnub"; at the top
  5. yarn start

Expected Behavior

Start with only a unused warning

Compiled with warnings.

./src/App.js
  Line 4:  'pubnub' is defined but never used  no-unused-vars

Actual Behavior

Compiles but give a runtime error in the browser. Screenshot_7

Uncaught TypeError: Cannot read property 'fd' of undefined at Function.useColors (node.js:60) at createDebug (debug.js:112) at Object. (index.js:14) at Object../node_modules/http-proxy-agent/index.js (index.js:110) at webpack_require (bootstrap:781) at fn (bootstrap:149) at Object../node_modules/pac-proxy-agent/index.js (index.js:36) at webpack_require (bootstrap:781) at fn (bootstrap:149) at Object../node_modules/proxy-agent/index.js (index.js:22) at webpack_require (bootstrap:781) at fn (bootstrap:149) at Object../node_modules/superagent-proxy/index.js (index.js:4) at webpack_require (bootstrap:781) at fn (bootstrap:149) at Object../node_modules/pubnub/lib/networking/modules/node.js (node.js:11) at webpack_require (bootstrap:781) at fn (bootstrap:149) at Object../node_modules/pubnub/lib/node/index.js (index.js:16) at webpack_require (bootstrap:781) at fn (bootstrap:149) at Module../src/App.js (App.css?4433:45) at webpack_require (bootstrap:781) at fn (bootstrap:149) at Module../src/index.js (index.css?f3f6:45) at webpack_require (bootstrap:781) at fn (bootstrap:149) at Object.0 (serviceWorker.js:135) at webpack_require (bootstrap:781) at checkDeferredModules (bootstrap:45) at Array.webpackJsonpCallback [as push] (bootstrap:32) at main.chunk.js:1

Reproducible Demo

Can't recreate the issue in codesandbox. Creating the issue in a new project as described above is fast and straightforward.

Some tests I did

  1. Tried with nodejs 10.16.3/12.9.1 with same issue.
  2. Tried with official react-scripts 3.0.1 and 3.1.1 and I do not face the issue.

Thanks

Ethorsen avatar Aug 27 '19 15:08 Ethorsen

Are you still trying to get this working?

F1LT3R avatar Mar 18 '20 17:03 F1LT3R