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

Couldn't find preset "es2015" relative to directory node_modules/redux-socket.io #32

Open
mounibec opened this issue Jul 11, 2017 · 9 comments

Comments

@mounibec
Copy link

When I add an import createSocketIoMiddleware from 'redux-socket.io'; I get this error in runtime:

Couldn't find preset "es2015" relative to directory node_modules/redux-socket.io

Versions used:

  • "redux-socket.io": "1.4.0",
  • "react": "15.4.2",
  • "react-native": "0.42.0"

error

Am I missing something ?

Thanks !

@digitaldangal
Copy link

I am exact same issue i installed npm install --save-dev babel-preset-es2015 but still not working.anyone find any solution

@itaylor
Copy link
Owner

itaylor commented Jul 12, 2017

Hmm, I've not seen this myself. Could someone create a minimal reproduction case in a repo so that I can try to figure out what's going on? My guess is that there is some part of the tooling stack you're using that is looking at the .babelrc for this project, which should not be needed/used unless you're building the project from source.

@itaylor
Copy link
Owner

itaylor commented Jul 12, 2017

To test my above theory, you could try removing the file node_modules/redux-socket.io/.babelrc and see if this error goes away.

@pensierinmusica
Copy link

pensierinmusica commented Jul 27, 2017

@digitaldangal I have exactly the same problem.

It got fixed by running npm i babel-preset-es2015. Although it seems to be a bug of redux-socket.io. @itaylor any idea what could be causing this?

What is this code doing at the beginning of dist/index.js?

Object.defineProperty(exports, "__esModule", {
  value: true
});

@aboeglin
Copy link

aboeglin commented Sep 15, 2017

@itaylor No, removing .babelrc doesn't change anything, it's really weird .. I'll go with the solution of @pensierinmusica for now.

edit: Actually the suggested solution doesn't seem to work in my case ..

@aforty
Copy link

aforty commented Oct 26, 2017

Removing .babelrc does fix the problem. You have to run watchman watch-del-all && rm -rf $TMPDIR/react-* to clear the build cache.

Can we exclude .babelrc from the package?

@itaylor
Copy link
Owner

itaylor commented Oct 27, 2017

@aforty, Yes, I think excluding the .babelrc could be done by adding a .npmignore that excludes the .babelrc. That would prevent the .babelrc from being picked up in the npm package. It seems strange that this is necessary, as there should be no reason for your tools to pick it up since the code is shipped pre-compiled by babel. Am I correct in assuming that this only happens to people using react-native?

@aforty
Copy link

aforty commented Oct 27, 2017

Correct, it’s the way the build tool works for react-native unfortunately.

@grapewheel
Copy link

grapewheel commented Nov 4, 2017

npm i babel-preset-es2015 --save-dev OR yarn add babel-preset-es2015 --dev

I'm using the create-react-native-app, it was fixed when installed the preset

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

7 participants