Socket.io-client: yarn build error

Created on 15 Oct 2019  Β·  24Comments  Β·  Source: socketio/socket.io-client

yarn run v1.19.1
$ react-scripts build
Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file:

./node_modules/socket.io-client/node_modules/debug/src/browser.js:155

Read more here: http://bit.ly/2tRViJ9

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Unable to reproduce

Most helpful comment

Please try to downgrade socket.io-client version to 1.7.0, then above issue will be gone away

All 24 comments

Facing same issue

Facing same issue using npm and react-script

Facing same issue.. any idea? I upgraded version to latest version. but still no luck

Same here

I got same issue

Please try to downgrade socket.io-client version to 1.7.0, then above issue will be gone away

oh my gosh @guixiao417 thanks, it worked for me! Thank you!

@guixiao417 it works!

@guixiao417 works for me.

Is it possible to keep using the newest stable version of the socket.io-client with react-scripts? Downgrading is not really a solution for me.

thre is a way insted of downgrade? all of my modual are update to the laste verion.

I tried but it was not working for last version

On Sat, Apr 18, 2020 at 4:33 PM mahshid22 notifications@github.com wrote:

thre is a way insted of downgrade? all of my modual are update to the
laste verion.

β€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/socketio/socket.io-client/issues/1330#issuecomment-615761081,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AKYG6AGEG2PIRG5Z5YPV3D3RNFQV5ANCNFSM4JAWTPRQ
.

@guixiao417 you saved my day thanks a lot

My pleasure

On Sun, Apr 19, 2020 at 5:20 PM Goutham JM notifications@github.com wrote:

@guixiao417 https://github.com/guixiao417 you saved my day thanks a lot

β€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/socketio/socket.io-client/issues/1330#issuecomment-616083860,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AKYG6AGENO7RSCWRZB6QCOLRNK65VANCNFSM4JAWTPRQ
.

I updated react-script to latest (3.4.1 at this time) and followed the instructions from yarn build. Ended up removing babel-eslint and eslint and was able to build successfully.

Also not happy with the approach of downgrading to an old version, but it's the only thing that works for us at the moment.

This bug messed me up. The downgrading way is a good solution.
I can only use the latest version through script which annoys me.

What I ended up doing was, download socket.io-client latest 2.3.0 and save it in ./client/scripts/vendor, then use a webpack alias:

  resolve: {
    alias: {
      'socket-io.client': __dirname + '/client/scripts/vendor/socket.io-client.2.3.0'
    }
  },

This compiled fine and did not produce any yarn build errors.

Please try to downgrade socket.io-client version to 1.7.0, then above issue will be gone away

Thx bro u da best!!! It works thank you!!

I complete remove socket.io and my problem was fixed. thanks!

Hi! I'm not able to reproduce: https://github.com/socketio/socket.io/tree/master/examples/create-react-app-example

$ yarn build
yarn run v1.22.4
$ react-scripts build
Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  66.34 KB (+1 B)  build/static/js/2.333cb71d.chunk.js
  783 B            build/static/js/runtime-main.4d1b81e4.js
  718 B (-2 B)     build/static/js/main.c951bd20.chunk.js
  547 B            build/static/css/main.5f361e03.chunk.css

The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.
You may serve it with a static server:

  yarn global add serve
  serve -s build

Find out more about deployment here:

  bit.ly/CRA-deploy

Done in 9.16s.

$ npx serve -s build
npx: installed 78 in 4.816s

   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚                                                 β”‚
   β”‚   Serving!                                      β”‚
   β”‚                                                 β”‚
   β”‚   - Local:            http://localhost:5000     β”‚
   β”‚   - On Your Network:  http://192.168.0.2:5000   β”‚
   β”‚                                                 β”‚
   β”‚   Copied local address to clipboard!            β”‚
   β”‚                                                 β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

I had the issue aswell except the token error was for index, downgraded to 1.7.0 and saw success

Worked for me thanks!

FWIW, I was experiencing this exact error with npm/webpack, using the Node 14.x Docker image. Upgrading to the Node 15.x image solved the problem. In both instances (failing and building) I was using the same socket.io-client package version - 2.3.1.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zappfinger picture zappfinger  Β·  5Comments

gtk2k picture gtk2k  Β·  3Comments

vadimka123 picture vadimka123  Β·  6Comments

najibghadri picture najibghadri  Β·  7Comments

Sairyss picture Sairyss  Β·  4Comments